Remove the unnecessary initFuture in the LibP2P p2pProtocol back-end

This commit is contained in:
Zahary Karadjov 2020-04-15 05:33:52 +03:00
parent 6513cd9eff
commit bac6248301
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 3 additions and 5 deletions

View File

@ -532,6 +532,9 @@ proc setBody*(sendProc: SendProc, body: NimNode) =
proc writeParamsAsRecord*(params: openarray[NimNode], proc writeParamsAsRecord*(params: openarray[NimNode],
outputStream, Format, RecordType: NimNode): NimNode = outputStream, Format, RecordType: NimNode): NimNode =
if params.len == 0:
return newStmtList()
var var
appendParams = newStmtList() appendParams = newStmtList()
recordWriterCtx = ident "recordWriterCtx" recordWriterCtx = ident "recordWriterCtx"
@ -568,7 +571,6 @@ proc useStandardBody*(sendProc: SendProc,
outputStream = ident "outputStream" outputStream = ident "outputStream"
msgBytes = ident "msgBytes" msgBytes = ident "msgBytes"
initFuture = bindSym "initFuture"
recipient = sendProc.peerParam recipient = sendProc.peerParam
msgRecName = msg.recName msgRecName = msg.recName
Format = msg.protocol.backend.SerializationFormat Format = msg.protocol.backend.SerializationFormat
@ -584,9 +586,6 @@ proc useStandardBody*(sendProc: SendProc,
appendParams = newStmtList() appendParams = newStmtList()
initResultFuture = if msg.kind != msgRequest: newStmtList()
else: newCall(initFuture, resultIdent)
sendCall = sendCallGenerator(recipient, msgBytes) sendCall = sendCallGenerator(recipient, msgBytes)
tracing = when not tracingEnabled: tracing = when not tracingEnabled:
@ -600,7 +599,6 @@ proc useStandardBody*(sendProc: SendProc,
sendProc.setBody quote do: sendProc.setBody quote do:
mixin init, WriterType, beginRecord, endRecord, getOutput mixin init, WriterType, beginRecord, endRecord, getOutput
`initResultFuture`
var `outputStream` = memoryOutput() var `outputStream` = memoryOutput()
`preSerialization` `preSerialization`
`serilization` `serilization`