Pass ReuseAddr flag for wakunode2 (#223)

This commit is contained in:
Kim De Mey 2020-10-14 05:32:37 +02:00 committed by GitHub
parent c2024344cf
commit f31ab81546
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -59,6 +59,7 @@ proc init*(T: type WakuNode, nodeKey: crypto.PrivateKey,
## Status: Implemented.
##
let
rng = crypto.newRng()
hostAddress = tcpEndPoint(bindIp, bindPort)
announcedAddresses = if extIp.isNone() or extPort.isNone(): @[]
else: @[tcpEndPoint(extIp.get(), extPort.get())]
@ -68,7 +69,8 @@ proc init*(T: type WakuNode, nodeKey: crypto.PrivateKey,
# XXX: Add this when we create node or start it?
peerInfo.addrs.add(hostAddress)
var switch = newStandardSwitch(some(nodekey), hostAddress)
var switch = newStandardSwitch(some(nodekey), hostAddress,
transportFlags = {ServerFlags.ReuseAddr}, rng = rng)
# TODO Untested - verify behavior after switch interface change
# More like this:
# let pubsub = GossipSub.init(
@ -88,7 +90,7 @@ proc init*(T: type WakuNode, nodeKey: crypto.PrivateKey,
result = WakuNode(
switch: switch,
rng: crypto.newRng(),
rng: rng,
peerInfo: peerInfo,
wakuRelay: wakuRelay,
subscriptions: newTable[string, MessageNotificationSubscription](),