Start discovery after announce address is updated (#536)
* Start discovery after announce address is updated * Moves switch start-stop to codex.nim. Adjusts timing to solve issue
This commit is contained in:
parent
545e0d47e1
commit
d279eebd69
|
@ -113,12 +113,10 @@ proc start*(s: CodexServer) {.async.} =
|
|||
notice "Starting codex node"
|
||||
|
||||
await s.repoStore.start()
|
||||
s.restServer.start()
|
||||
|
||||
s.codexNode.contracts = await bootstrapInteractions(s.config, s.repoStore)
|
||||
await s.codexNode.start()
|
||||
s.maintenance.start()
|
||||
|
||||
await s.codexNode.switch.start()
|
||||
|
||||
let
|
||||
# TODO: Can't define these as constants, pity
|
||||
natIpPart = MultiAddress.init("/ip4/" & $s.config.nat & "/")
|
||||
|
@ -144,6 +142,10 @@ proc start*(s: CodexServer) {.async.} =
|
|||
s.codexNode.discovery.updateAnnounceRecord(announceAddrs)
|
||||
s.codexNode.discovery.updateDhtRecord(s.config.nat, s.config.discoveryPort)
|
||||
|
||||
s.codexNode.contracts = await bootstrapInteractions(s.config, s.repoStore)
|
||||
await s.codexNode.start()
|
||||
s.restServer.start()
|
||||
|
||||
s.runHandle = newFuture[void]("codex.runHandle")
|
||||
await s.runHandle
|
||||
|
||||
|
@ -152,6 +154,7 @@ proc stop*(s: CodexServer) {.async.} =
|
|||
|
||||
await allFuturesThrowing(
|
||||
s.restServer.stop(),
|
||||
s.codexNode.switch.stop(),
|
||||
s.codexNode.stop(),
|
||||
s.repoStore.stop(),
|
||||
s.maintenance.stop())
|
||||
|
|
|
@ -327,9 +327,6 @@ proc new*(
|
|||
contracts: contracts)
|
||||
|
||||
proc start*(node: CodexNodeRef) {.async.} =
|
||||
if not node.switch.isNil:
|
||||
await node.switch.start()
|
||||
|
||||
if not node.engine.isNil:
|
||||
await node.engine.start()
|
||||
|
||||
|
@ -406,9 +403,6 @@ proc stop*(node: CodexNodeRef) {.async.} =
|
|||
if not node.engine.isNil:
|
||||
await node.engine.stop()
|
||||
|
||||
if not node.switch.isNil:
|
||||
await node.switch.stop()
|
||||
|
||||
if not node.erasure.isNil:
|
||||
await node.erasure.stop()
|
||||
|
||||
|
|
Loading…
Reference in New Issue