Quickfix for a potential double future completion in rlpx (#538)

This commit is contained in:
Kim De Mey 2022-10-06 13:34:35 +02:00 committed by GitHub
parent 591360284b
commit ba69c1ff29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -148,7 +148,9 @@ proc requestResolver[MsgType](msg: pointer, future: FutureBase) {.gcsafe.} =
proc linkSendFailureToReqFuture[S, R](sendFut: Future[S], resFut: Future[R]) = proc linkSendFailureToReqFuture[S, R](sendFut: Future[S], resFut: Future[R]) =
sendFut.addCallback() do (arg: pointer): sendFut.addCallback() do (arg: pointer):
if not sendFut.error.isNil: # Avoiding potentially double future completions
if not resFut.finished:
if sendFut.failed:
resFut.fail(sendFut.error) resFut.fail(sendFut.error)
proc messagePrinter[MsgType](msg: pointer): string {.gcsafe.} = proc messagePrinter[MsgType](msg: pointer): string {.gcsafe.} =