Skip to content

Commit

Permalink
reset streams on panic
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed Oct 3, 2024
1 parent 96d1106 commit aa2caf0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions p2p/protocol/autonatv2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ func (ac *client) handleDialBack(s network.Stream) {
if rerr := recover(); rerr != nil {
fmt.Fprintf(os.Stderr, "caught panic: %s\n%s\n", rerr, debug.Stack())
}
s.Reset()
}()

if err := s.Scope().SetService(ServiceName); err != nil {
Expand Down
1 change: 1 addition & 0 deletions p2p/protocol/autonatv2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (as *server) handleDialRequest(s network.Stream) {
defer func() {
if rerr := recover(); rerr != nil {
fmt.Fprintf(os.Stderr, "caught panic: %s\n%s\n", rerr, debug.Stack())
s.Reset()
}
}()

Expand Down

0 comments on commit aa2caf0

Please sign in to comment.