Small fixes needed for the latest ETH networking spec

This commit is contained in:
Zahary Karadjov 2019-09-08 22:36:37 -04:00
parent 14e99e0711
commit 517adbbbca
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 2 additions and 1 deletions

View File

@ -347,7 +347,7 @@ proc hasReqId*(msg: Message): bool =
proc ResponderType(msg: Message): NimNode =
var resp = if msg.kind == msgRequest: msg.response else: msg
newTree(nnkBracketExpr,
msg.protocol.backend.ResponderType, resp.recName)
msg.protocol.backend.ResponderType, resp.strongRecName)
proc newMsg(protocol: P2PProtocol, kind: MessageKind, id: int,
procDef: NimNode, timeoutParam: NimNode = nil,
@ -814,6 +814,7 @@ proc genTypeSection*(p: P2PProtocol): NimNode =
# a particular message type:
template msgId*(T: type `msgStrongRecName`): int = `msgId`
template msgProtocol*(T: type `msgStrongRecName`): type = `protocolName`
template RecType*(T: type `msgStrongRecName`): untyped = `msgRecName`
proc genCode*(p: P2PProtocol): NimNode =
# TODO: try switching to a simpler for msg in p.messages: loop