go/p2p: Ensure only server providers advertise themselves#6270
go/p2p: Ensure only server providers advertise themselves#6270martintomazic merged 2 commits intomasterfrom
Conversation
✅ Deploy Preview for oasisprotocol-oasis-core canceled.
|
a6c7baa to
9b02396
Compare
9b02396 to
4fb3d38
Compare
peternose
left a comment
There was a problem hiding this comment.
This is not optimal: before that we should check all connected peers via m.host.Peerstore().GetProtocols(remoteID). This way we avoid round-trip to seed nodes. More importantly, we can reuse existing connections and only open a new stream for a new protocol.
Once we connect to a node, we always take into account all its protocols before connecting new ones. See NumProtocolPeers. So when we are out of nodes, we should discover them via seed nodes.
97636bf to
da92e5c
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6270 +/- ##
==========================================
+ Coverage 64.50% 64.83% +0.33%
==========================================
Files 689 689
Lines 67114 67127 +13
==========================================
+ Hits 43290 43525 +235
+ Misses 18837 18602 -235
- Partials 4987 5000 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What is identity protocol? |
This unifies style with light client protocol. In the future we may want to make protocol id and versions private and only keep the helper function.
da92e5c to
99005c5
Compare
peternose
left a comment
There was a problem hiding this comment.
Looks good, will approve once commits are merged.
https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/identify/id.go - responsible for keeping protobook up to date. This is complementary to your answer #6270 (review) as to how seed nodes are last resource. |
99005c5 to
ebff391
Compare
ebff391 to
2068173
Compare
| default: | ||
| } | ||
|
|
||
| d.logger.Debug("triggered protocol advertisement", |
There was a problem hiding this comment.
This could also be optional as I just saw that we log started advertising when the running thread picks up a new namespace.
Tackles #6262 (comment), see existing slack discussion.
Only hosts that serve p2p protocol should advertise themselves via seed nodes for peer discovery.