This commit is contained in:
Zack Scholl 2018-09-26 09:36:25 -07:00
parent 0bd4a0ac75
commit 089d2bbe1a
3 changed files with 4 additions and 8 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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()
}
}
}