check for nil on start/stop
This commit is contained in:
parent
1e0cc290f8
commit
06e043871c
|
@ -44,10 +44,17 @@ type
|
||||||
discovery*: Discovery
|
discovery*: Discovery
|
||||||
|
|
||||||
proc start*(node: DaggerNodeRef) {.async.} =
|
proc start*(node: DaggerNodeRef) {.async.} =
|
||||||
await node.switch.start()
|
if not node.switch.isNil:
|
||||||
await node.engine.start()
|
await node.switch.start()
|
||||||
await node.erasure.start()
|
|
||||||
await node.discovery.start()
|
if not node.engine.isNil:
|
||||||
|
await node.engine.start()
|
||||||
|
|
||||||
|
if not node.erasure.isNil:
|
||||||
|
await node.erasure.start()
|
||||||
|
|
||||||
|
if not node.discovery.isNil:
|
||||||
|
await node.discovery.start()
|
||||||
|
|
||||||
node.networkId = node.switch.peerInfo.peerId
|
node.networkId = node.switch.peerInfo.peerId
|
||||||
notice "Started dagger node", id = $node.networkId, addrs = node.switch.peerInfo.addrs
|
notice "Started dagger node", id = $node.networkId, addrs = node.switch.peerInfo.addrs
|
||||||
|
@ -55,10 +62,17 @@ proc start*(node: DaggerNodeRef) {.async.} =
|
||||||
proc stop*(node: DaggerNodeRef) {.async.} =
|
proc stop*(node: DaggerNodeRef) {.async.} =
|
||||||
trace "Stopping node"
|
trace "Stopping node"
|
||||||
|
|
||||||
await node.engine.stop()
|
if not node.engine.isNil:
|
||||||
await node.switch.stop()
|
await node.engine.stop()
|
||||||
await node.erasure.stop()
|
|
||||||
await node.discovery.stop()
|
if not node.switch.isNil:
|
||||||
|
await node.switch.stop()
|
||||||
|
|
||||||
|
if not node.erasure.isNil:
|
||||||
|
await node.erasure.stop()
|
||||||
|
|
||||||
|
if not node.discovery.isNil:
|
||||||
|
await node.discovery.stop()
|
||||||
|
|
||||||
proc findPeer*(
|
proc findPeer*(
|
||||||
node: DaggerNodeRef,
|
node: DaggerNodeRef,
|
||||||
|
|
Loading…
Reference in New Issue