Closed kushti closed 3 years ago
I have several questions:
@knizhnik My bad likely, it was better to start with motivation. Which is about the need to recognize whether connectivity globally (with all the peers) is lost or not. If it lost, then we can consider our syncing status differently, show warning in a UI etc.
Thus this variable is global for all the peers.
/info is not in Scorex, it is Scorex-specific. In Ergo, we can enrich /info for sure.
Sorry, I do not understand your answers. My first questions was why do we need to add some global variable to NetworkController insteadof just calculating max(lastSeen) ?
Also I do not understand "/info is not in Scorex, it is Scorex-specific". All API methods are declared in openapi.yaml aren't them? No AI methods are defined in Scorex, aren't them? So, as far as I understand this task requires patching both "scorex" and "ergo" projects.
I have created PR https://github.com/ScorexFoundation/Scorex/pull/376 Not sure that it is enough and whether openapi.yaml in ergo should also be changed.
Done in #376
Do this on top of PR #373 :
1) Like #373 is using message got from a peer to drop inactive connection (in NetworkController), introduce global variable in NetworkController which is storing when we got last message from the network
2) Introduce a new API method /peers/status (PeersApiRoute) which is returning something like {"lastIncomingMessage":XXX, "currentNetworkTime":XXX}