mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-16 14:57:54 +00:00
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"
|
notice "Starting codex node"
|
||||||
|
|
||||||
await s.repoStore.start()
|
await s.repoStore.start()
|
||||||
s.restServer.start()
|
|
||||||
|
|
||||||
s.codexNode.contracts = await bootstrapInteractions(s.config, s.repoStore)
|
|
||||||
await s.codexNode.start()
|
|
||||||
s.maintenance.start()
|
s.maintenance.start()
|
||||||
|
|
||||||
|
await s.codexNode.switch.start()
|
||||||
|
|
||||||
let
|
let
|
||||||
# TODO: Can't define these as constants, pity
|
# TODO: Can't define these as constants, pity
|
||||||
natIpPart = MultiAddress.init("/ip4/" & $s.config.nat & "/")
|
natIpPart = MultiAddress.init("/ip4/" & $s.config.nat & "/")
|
||||||
@ -144,6 +142,10 @@ proc start*(s: CodexServer) {.async.} =
|
|||||||
s.codexNode.discovery.updateAnnounceRecord(announceAddrs)
|
s.codexNode.discovery.updateAnnounceRecord(announceAddrs)
|
||||||
s.codexNode.discovery.updateDhtRecord(s.config.nat, s.config.discoveryPort)
|
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")
|
s.runHandle = newFuture[void]("codex.runHandle")
|
||||||
await s.runHandle
|
await s.runHandle
|
||||||
|
|
||||||
@ -152,6 +154,7 @@ proc stop*(s: CodexServer) {.async.} =
|
|||||||
|
|
||||||
await allFuturesThrowing(
|
await allFuturesThrowing(
|
||||||
s.restServer.stop(),
|
s.restServer.stop(),
|
||||||
|
s.codexNode.switch.stop(),
|
||||||
s.codexNode.stop(),
|
s.codexNode.stop(),
|
||||||
s.repoStore.stop(),
|
s.repoStore.stop(),
|
||||||
s.maintenance.stop())
|
s.maintenance.stop())
|
||||||
|
@ -327,9 +327,6 @@ proc new*(
|
|||||||
contracts: contracts)
|
contracts: contracts)
|
||||||
|
|
||||||
proc start*(node: CodexNodeRef) {.async.} =
|
proc start*(node: CodexNodeRef) {.async.} =
|
||||||
if not node.switch.isNil:
|
|
||||||
await node.switch.start()
|
|
||||||
|
|
||||||
if not node.engine.isNil:
|
if not node.engine.isNil:
|
||||||
await node.engine.start()
|
await node.engine.start()
|
||||||
|
|
||||||
@ -406,9 +403,6 @@ proc stop*(node: CodexNodeRef) {.async.} =
|
|||||||
if not node.engine.isNil:
|
if not node.engine.isNil:
|
||||||
await node.engine.stop()
|
await node.engine.stop()
|
||||||
|
|
||||||
if not node.switch.isNil:
|
|
||||||
await node.switch.stop()
|
|
||||||
|
|
||||||
if not node.erasure.isNil:
|
if not node.erasure.isNil:
|
||||||
await node.erasure.stop()
|
await node.erasure.stop()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user