mirror of
https://github.com/status-im/status-go.git
synced 2025-02-17 01:08:12 +00:00
* Make it possible to explicitly disable discovery Discovery will be disabled in following cases: - if there are not bootnodes - v5 server will be disabled because there is no point in running it - if user defined in config NoDiscovery=true this value will be preserved even if we have bootnodes So, basically discovery will be always enabled by default on mobile, unless it is explicitly specified otherwise. When statusd is used current behavior is that discovery is disabled by default. I kept it in this change, but it would be better to change it. * Fix leftovers * Add wait group to peer pool to protect from races with p2p.Server * Change fields only when all goroutines finished * Turn off discovery after topic searches are stopped * Don't set period to nil to avoid race with SearchTopic * Close period chan only when all writers are finished
Peer pool signals
Peer pool sends 3 types of signals.
Discovery started signal will be sent once discovery server is started. And every time node will have to re-start discovery server because peer number dropped too low.
{
"type": "discovery.started",
"event": null
}
Discovery stopped signal will be sent once discovery found max limit of peers for every registered topic.
{
"type": "discovery.stopped",
"event": null
}
Discovery summary signal will be sent every time new peer is added or removed from a cluster. It will contain a map with capability as a key and total numbers of peers with that capability as a value.
{
"type": "discovery.summary",
"event": {
"shh/6": 1
}
}
Or if we don't have any peers:
{
"type": "discovery.summary",
"event": {}
}