|
|
@@ -47,6 +47,7 @@ func (p *Proxy) accept(conn net.Conn) {
|
|
47
|
47
|
ctx, cancel := context.WithCancel(context.Background())
|
|
48
|
48
|
|
|
49
|
49
|
defer func() {
|
|
|
50
|
+ cancel()
|
|
50
|
51
|
conn.Close() // nolint: errcheck
|
|
51
|
52
|
|
|
52
|
53
|
if err := recover(); err != nil {
|
|
|
@@ -74,6 +75,12 @@ func (p *Proxy) accept(conn net.Conn) {
|
|
74
|
75
|
}
|
|
75
|
76
|
defer serverConn.(io.Closer).Close() // nolint: errcheck
|
|
76
|
77
|
|
|
|
78
|
+ go func() {
|
|
|
79
|
+ <-ctx.Done()
|
|
|
80
|
+ serverConn.(io.Closer).Close()
|
|
|
81
|
+ clientConn.(io.Closer).Close()
|
|
|
82
|
+ }()
|
|
|
83
|
+
|
|
77
|
84
|
wait := &sync.WaitGroup{}
|
|
78
|
85
|
wait.Add(2)
|
|
79
|
86
|
|