Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 04367d9

Browse files
committed
Fix forwarding TCP to a local port
1 parent 2382dc2 commit 04367d9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tailnet/conn.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,11 @@ func (c *Conn) forwardTCPToLocal(conn net.Conn, port uint16) {
461461
_, err := io.Copy(conn, server)
462462
connClosed <- err
463463
}()
464-
err = <-connClosed
464+
select {
465+
case err = <-connClosed:
466+
case <-c.closed:
467+
return
468+
}
465469
if err != nil {
466470
c.logger.Debug(ctx, "proxy connection closed with error", slog.Error(err))
467471
}

0 commit comments

Comments
 (0)