Some fixes
This commit is contained in:
parent
6ac6397d33
commit
cf6b4d3084
|
@ -15,6 +15,7 @@ requires "nim > 0.18.0",
|
||||||
"ranges",
|
"ranges",
|
||||||
"stint",
|
"stint",
|
||||||
"byteutils",
|
"byteutils",
|
||||||
|
"chronicles",
|
||||||
"https://github.com/status-im/nim-asyncdispatch2"
|
"https://github.com/status-im/nim-asyncdispatch2"
|
||||||
|
|
||||||
proc runTest(name: string, lang = "c") = exec "nim " & lang & " -r tests/" & name
|
proc runTest(name: string, lang = "c") = exec "nim " & lang & " -r tests/" & name
|
||||||
|
|
|
@ -391,7 +391,7 @@ proc resolveResponseFuture(peer: Peer, msgId: int, msg: pointer, reqId: int) =
|
||||||
for req in outstandingReqs:
|
for req in outstandingReqs:
|
||||||
if not req.future.finished: break
|
if not req.future.finished: break
|
||||||
inc expiredRequests
|
inc expiredRequests
|
||||||
outstandingReqs.shrink(fromFront = expiredRequests)
|
outstandingReqs.shrink(fromFirst = expiredRequests)
|
||||||
if outstandingReqs.len > 0:
|
if outstandingReqs.len > 0:
|
||||||
let oldestReq = outstandingReqs.popFirst
|
let oldestReq = outstandingReqs.popFirst
|
||||||
assert oldestReq.reqId == -1
|
assert oldestReq.reqId == -1
|
||||||
|
@ -422,7 +422,7 @@ proc resolveResponseFuture(peer: Peer, msgId: int, msg: pointer, reqId: int) =
|
||||||
if idx != outstandingReqs.len - 1:
|
if idx != outstandingReqs.len - 1:
|
||||||
req = outstandingReqs.popLast
|
req = outstandingReqs.popLast
|
||||||
else:
|
else:
|
||||||
outstandingReqs.shrink(fromEnd = 1)
|
outstandingReqs.shrink(fromLast = 1)
|
||||||
# This was the last item, so we don't have any
|
# This was the last item, so we don't have any
|
||||||
# more work to do:
|
# more work to do:
|
||||||
return
|
return
|
||||||
|
@ -434,7 +434,7 @@ proc resolveResponseFuture(peer: Peer, msgId: int, msg: pointer, reqId: int) =
|
||||||
if idx != outstandingReqs.len - 1:
|
if idx != outstandingReqs.len - 1:
|
||||||
req = outstandingReqs.popLast
|
req = outstandingReqs.popLast
|
||||||
else:
|
else:
|
||||||
outstandingReqs.shrink(fromEnd = 1)
|
outstandingReqs.shrink(fromLast = 1)
|
||||||
return
|
return
|
||||||
|
|
||||||
inc idx
|
inc idx
|
||||||
|
|
Loading…
Reference in New Issue