waku-org / nwaku

Waku node and protocol.
Other
183 stars 46 forks source link

refactor: waku_node.nim - simplify stop proc #2645

Closed Ivansete-status closed 2 weeks ago

Ivansete-status commented 2 weeks ago

Description

There is no need to explicitly stop mounted libp2p protocols because they are already being stopped after the switch.stop() is being called.

Issue

I've noticed that while debugging: Peer Reconnection not working - https://github.com/waku-org/nwaku/issues/2592

github-actions[bot] commented 2 weeks ago

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2645-rln-v2

Built from ce0b29cfd182b1affaebab6dbfedaee61d3b77a9

github-actions[bot] commented 2 weeks ago

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2645-rln-v1

Built from ce0b29cfd182b1affaebab6dbfedaee61d3b77a9

Ivansete-status commented 2 weeks ago

Thanks for the comments @gabrielmer @SionoiS !

Services and protocols are different entities.

The protocols are actually stopped in https://github.com/vacp2p/nim-libp2p/blob/b30b2656d52ee304bd56f8f8bbf59ab82b658a36/libp2p/switch.nim#L320

image

Then from within MultistreamSelect object, we have the precise point where the mounted LPProtocols are stopped: https://github.com/vacp2p/nim-libp2p/blob/b30b2656d52ee304bd56f8f8bbf59ab82b658a36/libp2p/multistream.nim#L294

image


Aside note: the only service that we are currently attaching to the waku switch is the "autonat" one. See: image