Skip to content

Commit 1b7e778

Browse files
authored
Merge pull request #495 from blinklabs-io/fix/connection-handshake-shutdown-race
fix: avoid race condition on shutdown during handshake
2 parents cdfef1a + 6e44819 commit 1b7e778

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

connection.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,6 @@ func (c *Connection) shutdown() {
214214
c.waitGroup.Wait()
215215
// Close consumer error channel to signify connection shutdown
216216
close(c.errorChan)
217-
// We can only close a channel once, so we have to jump through a few hoops
218-
select {
219-
// The channel is either closed or has an item pending
220-
case _, ok := <-c.handshakeFinishedChan:
221-
// We successfully retrieved an item
222-
// This will probably never happen, but it doesn't hurt to cover this case
223-
if ok {
224-
close(c.handshakeFinishedChan)
225-
}
226-
// The channel is open and has no pending items
227-
default:
228-
close(c.handshakeFinishedChan)
229-
}
230217
}
231218

232219
// setupConnection establishes the muxer, configures and starts the handshake process, and initializes

0 commit comments

Comments
 (0)