We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7efa37f commit 7f81f77Copy full SHA for 7f81f77
tcpproxy.go
@@ -347,6 +347,8 @@ func UnderlyingConn(c net.Conn) net.Conn {
347
return c
348
}
349
350
+func goCloseConn(c net.Conn) { go c.Close() }
351
+
352
// HandleConn implements the Target interface.
353
func (dp *DialProxy) HandleConn(src net.Conn) {
354
ctx := context.Background()
@@ -362,13 +364,13 @@ func (dp *DialProxy) HandleConn(src net.Conn) {
362
364
dp.onDialError()(src, err)
363
365
return
366
- defer dst.Close()
367
+ defer goCloseConn(dst)
368
369
if err = dp.sendProxyHeader(dst, src); err != nil {
370
371
372
- defer src.Close()
373
+ defer goCloseConn(src)
374
375
if ka := dp.keepAlivePeriod(); ka > 0 {
376
if c, ok := UnderlyingConn(src).(*net.TCPConn); ok {
0 commit comments