From 7a961ecffde2a32a0661de0d96bf064e992fe402 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Wed, 26 Sep 2018 09:26:44 -0700 Subject: [PATCH] try fix --- src/tcp/tcp.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tcp/tcp.go b/src/tcp/tcp.go index 0bcca40..abd5bbe 100644 --- a/src/tcp/tcp.go +++ b/src/tcp/tcp.go @@ -2,6 +2,7 @@ package tcp import ( "bufio" + "bytes" "net" "sync" "time" @@ -167,14 +168,18 @@ func pipe(conn1 net.Conn, conn2 net.Conn) { return } writer2.Write(b1) - writer2.Flush() + if bytes.Equal(b1, "magic") { + writer2.Flush() + } case b2 := <-chan2: if b2 == nil { return } writer1.Write(b2) - writer1.Flush() + if bytes.Equal(b2, "magic") { + writer1.Flush() + } } } }