diff options
author | Yawning Angel <yawning@schwanenlied.me> | 2014-05-13 03:19:55 +0000 |
---|---|---|
committer | Yawning Angel <yawning@schwanenlied.me> | 2014-05-13 03:19:55 +0000 |
commit | d2b2e383fdc55424d4df7516677670d2b961309b (patch) | |
tree | fddf210a1a0adb96704b0fdc34125024658b544e /obfs4proxy | |
parent | 7a7b2af5165243f3f9611140cb75a341f7eb5ae8 (diff) |
Fix copyLoop to break out the other goroutine on graceful exit.
This should fix sockets getting stuck in CLOSE_WAIT.
Diffstat (limited to 'obfs4proxy')
-rw-r--r-- | obfs4proxy/obfs4proxy.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/obfs4proxy/obfs4proxy.go b/obfs4proxy/obfs4proxy.go index 42a6740..255bdf1 100644 --- a/obfs4proxy/obfs4proxy.go +++ b/obfs4proxy/obfs4proxy.go @@ -88,22 +88,22 @@ func copyLoop(a, b net.Conn) { go func() { defer logAndRecover() defer wg.Done() + defer b.Close() + defer a.Close() _, err := io.Copy(b, a) if err != nil { - b.Close() - a.Close() log.Printf("[WARN] Connection closed: %s", err) } }() go func() { defer logAndRecover() defer wg.Done() + defer a.Close() + defer b.Close() _, err := io.Copy(a, b) if err != nil { - a.Close() - b.Close() log.Printf("[WARN] Connection closed: %s", err) } }() |