@@ -239,11 +239,14 @@ func TestPauseResume(t *testing.T) {
239
239
240
240
stopPoint := 50
241
241
blocksSent := 0
242
- var requestID graphsync.RequestID
242
+ requestIDChan := make ( chan graphsync.RequestID , 1 )
243
243
responder .RegisterOutgoingBlockHook (func (p peer.ID , requestData graphsync.RequestData , blockData graphsync.BlockData , hookActions graphsync.OutgoingBlockHookActions ) {
244
244
_ , has := requestData .Extension (td .extensionName )
245
245
if has {
246
- requestID = requestData .ID ()
246
+ select {
247
+ case requestIDChan <- requestData .ID ():
248
+ default :
249
+ }
247
250
blocksSent ++
248
251
if blocksSent == stopPoint {
249
252
hookActions .PauseResponse ()
@@ -259,7 +262,9 @@ func TestPauseResume(t *testing.T) {
259
262
timer := time .NewTimer (100 * time .Millisecond )
260
263
testutil .AssertDoesReceiveFirst (t , timer .C , "should pause request" , progressChan )
261
264
262
- responder .UnpauseResponse (td .host1 .ID (), requestID )
265
+ requestID := <- requestIDChan
266
+ err := responder .UnpauseResponse (td .host1 .ID (), requestID )
267
+ require .NoError (t , err )
263
268
264
269
blockChain .VerifyRemainder (ctx , progressChan , stopPoint )
265
270
testutil .VerifyEmptyErrors (ctx , t , errChan )
0 commit comments