From 089d2bbe1a44be7eea2a511d0d69d40a7cdabb12 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Wed, 26 Sep 2018 09:36:25 -0700 Subject: [PATCH] try fix --- src/recipient/recipient.go | 2 +- src/sender/sender.go | 1 + src/tcp/tcp.go | 9 ++------- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/recipient/recipient.go b/src/recipient/recipient.go index 1e1fbdc..2c3a9ad 100644 --- a/src/recipient/recipient.go +++ b/src/recipient/recipient.go @@ -419,7 +419,7 @@ func connectToTCPServer(room string, address string) (com *comm.Comm, err error) connection.SetReadDeadline(time.Now().Add(3 * time.Hour)) connection.SetDeadline(time.Now().Add(3 * time.Hour)) connection.SetWriteDeadline(time.Now().Add(3 * time.Hour)) - + connection.SetNoDelay(true) com = comm.New(connection) log.Debug("waiting for server contact") ok, err := com.Receive() diff --git a/src/sender/sender.go b/src/sender/sender.go index 9e1f52e..fe6664c 100644 --- a/src/sender/sender.go +++ b/src/sender/sender.go @@ -420,6 +420,7 @@ func connectToTCPServer(room string, address string) (com *comm.Comm, err error) connection.SetReadDeadline(time.Now().Add(3 * time.Hour)) connection.SetDeadline(time.Now().Add(3 * time.Hour)) connection.SetWriteDeadline(time.Now().Add(3 * time.Hour)) + connection.SetNoDelay(true) com = comm.New(connection) ok, err := com.Receive() diff --git a/src/tcp/tcp.go b/src/tcp/tcp.go index f12f674..0bcca40 100644 --- a/src/tcp/tcp.go +++ b/src/tcp/tcp.go @@ -2,7 +2,6 @@ package tcp import ( "bufio" - "bytes" "net" "sync" "time" @@ -168,18 +167,14 @@ func pipe(conn1 net.Conn, conn2 net.Conn) { return } writer2.Write(b1) - if bytes.Equal(b1, []byte("magic")) { - writer2.Flush() - } + writer2.Flush() case b2 := <-chan2: if b2 == nil { return } writer1.Write(b2) - if bytes.Equal(b2, []byte("magic")) { - writer1.Flush() - } + writer1.Flush() } } }