Skip to content

Commit

Permalink
fix: unlock mutex on shutdown in blockfetch (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
agaffney authored Nov 18, 2024
1 parent 128b731 commit 68c6e9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions protocol/blockfetch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func (c *Client) GetBlockRange(start common.Point, end common.Point) error {
"role", "client",
"connection_id", c.callbackContext.ConnectionId.String(),
)
// NOTE: this will be unlocked on BatchDone
c.busyMutex.Lock()
c.blockUseCallback = true
msg := NewMsgRequestRange(start, end)
Expand All @@ -136,6 +137,7 @@ func (c *Client) GetBlockRange(start common.Point, end common.Point) error {
}
err, ok := <-c.startBatchResultChan
if !ok {
c.busyMutex.Unlock()
return protocol.ProtocolShuttingDownError
}
if err != nil {
Expand All @@ -155,6 +157,7 @@ func (c *Client) GetBlock(point common.Point) (ledger.Block, error) {
"role", "client",
"connection_id", c.callbackContext.ConnectionId.String(),
)
// NOTE: this will be unlocked on BatchDone
c.busyMutex.Lock()
c.blockUseCallback = false
msg := NewMsgRequestRange(point, point)
Expand Down

0 comments on commit 68c6e9b

Please sign in to comment.