Commit b08e0f55 authored by Steven Allen's avatar Steven Allen

fix(prq): return a closed channel when encountering a canceled context

Otherwise, we'll wait forever.
parent ee93aa83
......@@ -124,17 +124,25 @@ func (pqm *ProviderQueryManager) FindProvidersAsync(sessionCtx context.Context,
inProgressRequestChan: inProgressRequestChan,
}:
case <-pqm.ctx.Done():
return nil
ch := make(chan peer.ID)
close(ch)
return ch
case <-sessionCtx.Done():
return nil
ch := make(chan peer.ID)
close(ch)
return ch
}
var receivedInProgressRequest inProgressRequest
select {
case <-pqm.ctx.Done():
return nil
ch := make(chan peer.ID)
close(ch)
return ch
case <-sessionCtx.Done():
return nil
ch := make(chan peer.ID)
close(ch)
return ch
case receivedInProgressRequest = <-inProgressRequestChan:
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment