Skip to content

Commit

Permalink
peers: prevent multiple calls to Close on Handlers
Browse files Browse the repository at this point in the history
This is also a very ugly hack until the package got some love
  • Loading branch information
fionera committed Sep 28, 2024
1 parent f3fa116 commit 2a419d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions peers/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func newProtocolClient(ctx context.Context, rw io.ReadWriter, handler Handler) *

func (c *protocolClient) Close() error {
defer c.ctxCancel()
if c.ctx.Err() != nil {
return c.ctx.Err()
}

return c.handler.Close()
}
Expand Down

0 comments on commit 2a419d0

Please sign in to comment.