Skip to content

Commit

Permalink
fix(tcpreuse): handle connection that failed to be sampled
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Nov 12, 2024
1 parent 10045d1 commit 279be8d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions p2p/transport/tcpreuse/demultiplex.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func identifyConnType(c manet.Conn) (DemultiplexedConnType, manet.Conn, error) {

s, c, err := sampledconn.PeekBytes(c)
if err != nil {
if c == nil {
return 0, nil, err
}
closeErr := c.Close()
return 0, nil, errors.Join(err, closeErr)
}
Expand Down

0 comments on commit 279be8d

Please sign in to comment.