Skip to content

Commit

Permalink
Ensure context isn't nil in NoiseSocket.consumeFrames
Browse files Browse the repository at this point in the history
Fixes tulir#236
  • Loading branch information
tulir committed Nov 26, 2022
1 parent 4810a44 commit dc4f3fd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions socket/noisesocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func newNoiseSocket(fs *FrameSocket, writeKey, readKey cipher.AEAD, frameHandler
}

func (ns *NoiseSocket) consumeFrames(ctx context.Context, frames <-chan []byte) {
if ctx == nil {
// ctx being nil implies the connection already closed somehow
return
}
ctxDone := ctx.Done()
for {
select {
Expand Down

0 comments on commit dc4f3fd

Please sign in to comment.