Skip to content

Commit

Permalink
fix: Resolve a NRE when a connection is closed early
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Aug 13, 2024
1 parent 9be4117 commit b3dbde6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion proxy/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ func (l *Listener) handleConnection(ctx context.Context, srv *tsnet.Server, conn
select {
case <-ctx.Done():
case <-close:
log.Debug().Str("remote", conn.RemoteAddr().String()).Msg("Connection closed")
if addr := remote.RemoteAddr(); addr != nil {
log.Debug().Str("remote", addr.String()).Msg("Connection closed")
} else {
log.Debug().Msg("Connection closed")
}
}
}

0 comments on commit b3dbde6

Please sign in to comment.