From ca8519ef619026adb4a0fba7bf3f541b7ffa09a9 Mon Sep 17 00:00:00 2001 From: Yuriy Glukhov Date: Wed, 10 Apr 2019 16:57:19 +0300 Subject: [PATCH] Workaround compilation error cause by chronos newFuture changes --- eth/p2p/p2p_backends_helpers.nim | 4 ++-- eth/p2p/rlpx.nim | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eth/p2p/p2p_backends_helpers.nim b/eth/p2p/p2p_backends_helpers.nim index a4d5f2f..640b718 100644 --- a/eth/p2p/p2p_backends_helpers.nim +++ b/eth/p2p/p2p_backends_helpers.nim @@ -61,6 +61,6 @@ proc verifyStateType(t: NimNode): NimNode = if result.kind != nnkBracketExpr or $result[0] != "ref": macros.error($result & " must be a ref type") -proc newFuture[T](location: var Future[T]) = - location = newFuture[T]() +proc initFuture[T](loc: var Future[T]) = + loc = newFuture[T]() diff --git a/eth/p2p/rlpx.nim b/eth/p2p/rlpx.nim index da80edd..feebf75 100644 --- a/eth/p2p/rlpx.nim +++ b/eth/p2p/rlpx.nim @@ -500,7 +500,7 @@ proc nextMsg*(peer: Peer, MsgType: type): Future[MsgType] = if not f.isNil: return Future[MsgType](f) - newFuture result + initFuture result peer.awaitedMessages[wantedId] = result # Known fatal errors are handled inside dispatchMessages. @@ -776,12 +776,12 @@ macro p2pProtocolImpl(name: static[string], responseMsgId) if hasReqIds: appendParams.add quote do: - newFuture `resultIdent` + initFuture `resultIdent` let `reqId` = `registerRequestCall` paramsToWrite.add reqId else: appendParams.add quote do: - newFuture `resultIdent` + initFuture `resultIdent` discard `registerRequestCall` of rlpxResponse: