minor fixes
This commit is contained in:
parent
7384ab25d5
commit
bddec91d05
|
@ -165,8 +165,8 @@ The state objects are initialized to zero by default, but you can modify
|
|||
this behaviour by overriding the following procs for your state types:
|
||||
|
||||
```nim
|
||||
proc initProtocolState*(state: var MyPeerState, p: Peer)
|
||||
proc initProtocolState*(state: var MyNetworkState, n: EthereumNode)
|
||||
proc initProtocolState*(state: MyPeerState, p: Peer)
|
||||
proc initProtocolState*(state: MyNetworkState, n: EthereumNode)
|
||||
```
|
||||
|
||||
Sometimes, you'll need to access the state of another protocol.
|
||||
|
|
|
@ -73,8 +73,11 @@ proc processIncoming(server: StreamServer,
|
|||
else:
|
||||
remote.close()
|
||||
|
||||
proc listeningAddress*(node: EthereumNode): ENode =
|
||||
return initENode(node.keys.pubKey, node.address)
|
||||
|
||||
proc startListening*(node: EthereumNode) =
|
||||
trace "RLPx listener up", self = initENode(node.keys.pubKey, node.address)
|
||||
trace "RLPx listener up", self = node.listeningAddress
|
||||
let ta = initTAddress(node.address.ip, node.address.tcpPort)
|
||||
if node.listeningServer == nil:
|
||||
node.listeningServer = createStreamServer(ta, processIncoming,
|
||||
|
@ -156,5 +159,5 @@ proc randomPeerWith*(node: EthereumNode, Protocol: type): Peer =
|
|||
for p in node.peers(Protocol):
|
||||
candidates.add(p)
|
||||
if candidates.len > 0:
|
||||
return candidates[random(candidates.len)]
|
||||
return candidates[rand(candidates.len)]
|
||||
|
||||
|
|
|
@ -670,7 +670,7 @@ type
|
|||
proc run(peer: Peer) {.async.}
|
||||
proc run(node: EthereumNode, network: WhisperNetwork) {.async.}
|
||||
|
||||
proc initProtocolState*(network: var WhisperNetwork, node: EthereumNode) =
|
||||
proc initProtocolState*(network: WhisperNetwork, node: EthereumNode) =
|
||||
network.queue = initQueue(defaultQueueCapacity)
|
||||
network.filters = initTable[string, Filter]()
|
||||
network.config.bloom = fullBloom()
|
||||
|
|
Loading…
Reference in New Issue