Skip to content

Commit 68c6e9b

Browse files
authored
fix: unlock mutex on shutdown in blockfetch (#794)
1 parent 128b731 commit 68c6e9b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

protocol/blockfetch/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ func (c *Client) GetBlockRange(start common.Point, end common.Point) error {
127127
"role", "client",
128128
"connection_id", c.callbackContext.ConnectionId.String(),
129129
)
130+
// NOTE: this will be unlocked on BatchDone
130131
c.busyMutex.Lock()
131132
c.blockUseCallback = true
132133
msg := NewMsgRequestRange(start, end)
@@ -136,6 +137,7 @@ func (c *Client) GetBlockRange(start common.Point, end common.Point) error {
136137
}
137138
err, ok := <-c.startBatchResultChan
138139
if !ok {
140+
c.busyMutex.Unlock()
139141
return protocol.ProtocolShuttingDownError
140142
}
141143
if err != nil {
@@ -155,6 +157,7 @@ func (c *Client) GetBlock(point common.Point) (ledger.Block, error) {
155157
"role", "client",
156158
"connection_id", c.callbackContext.ConnectionId.String(),
157159
)
160+
// NOTE: this will be unlocked on BatchDone
158161
c.busyMutex.Lock()
159162
c.blockUseCallback = false
160163
msg := NewMsgRequestRange(point, point)

0 commit comments

Comments
 (0)