File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,8 @@ func UnderlyingConn(c net.Conn) net.Conn {
347347 return c
348348}
349349
350+ func goCloseConn (c net.Conn ) { go c .Close () }
351+
350352// HandleConn implements the Target interface.
351353func (dp * DialProxy ) HandleConn (src net.Conn ) {
352354 ctx := context .Background ()
@@ -362,13 +364,13 @@ func (dp *DialProxy) HandleConn(src net.Conn) {
362364 dp .onDialError ()(src , err )
363365 return
364366 }
365- defer dst . Close ( )
367+ defer goCloseConn ( dst )
366368
367369 if err = dp .sendProxyHeader (dst , src ); err != nil {
368370 dp .onDialError ()(src , err )
369371 return
370372 }
371- defer src . Close ( )
373+ defer goCloseConn ( src )
372374
373375 if ka := dp .keepAlivePeriod (); ka > 0 {
374376 if c , ok := UnderlyingConn (src ).(* net.TCPConn ); ok {
You can’t perform that action at this time.
0 commit comments