protocol.sendMessage: allow destination as (NodeId, Address)
This commit is contained in:
parent
a7d8082fc7
commit
d4af5b8a44
|
@ -379,6 +379,18 @@ proc waitNodes(d: Protocol, fromNode: Node, reqId: RequestId):
|
|||
discovery_message_requests_outgoing.inc(labelValues = ["no_response"])
|
||||
return err("Nodes message not received in time")
|
||||
|
||||
proc sendMessage*[T: SomeMessage](d: Protocol, toId: NodeId, toAddr: Address, m: T):
|
||||
RequestId =
|
||||
let
|
||||
reqId = RequestId.init(d.rng[])
|
||||
message = encodeMessage(m, reqId)
|
||||
|
||||
trace "Send message packet", dstId = toId, toAddr, kind = messageKind(T)
|
||||
discovery_message_requests_outgoing.inc()
|
||||
|
||||
d.transport.sendMessage(toId, toAddr, message)
|
||||
return reqId
|
||||
|
||||
proc sendMessage*[T: SomeMessage](d: Protocol, toNode: Node, m: T):
|
||||
RequestId =
|
||||
doAssert(toNode.address.isSome())
|
||||
|
|
Loading…
Reference in New Issue