vacp2p / nim-libp2p

libp2p implementation in Nim
https://vacp2p.github.io/nim-libp2p/docs/
MIT License
249 stars 54 forks source link

Limited Forwarding (delayed elimination of peers from which message/idontwant is received) #1027

Open ufarooqstatus opened 7 months ago

ufarooqstatus commented 7 months ago

Remove peers from the relay (ToSendPeers) list, from which message or idontwant is received. We delay this action till sendMsg to increase such peer count.

codecov[bot] commented 7 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (fe4ff79) 83.28% compared to head (3fb83b8) 83.31%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1027/graphs/tree.svg?width=650&height=150&src=pr&token=UR5JRQ249W&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im)](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im) ```diff @@ Coverage Diff @@ ## p2p-research #1027 +/- ## ================================================ + Coverage 83.28% 83.31% +0.02% ================================================ Files 91 91 Lines 15442 15454 +12 ================================================ + Hits 12861 12875 +14 + Misses 2581 2579 -2 ``` | [Files](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im) | Coverage Δ | | |---|---|---| | [libp2p/protocols/pubsub/pubsub.nim](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im#diff-bGlicDJwL3Byb3RvY29scy9wdWJzdWIvcHVic3ViLm5pbQ==) | `85.44% <100.00%> (ø)` | | | [libp2p/protocols/pubsub/gossipsub.nim](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im#diff-bGlicDJwL3Byb3RvY29scy9wdWJzdWIvZ29zc2lwc3ViLm5pbQ==) | `88.07% <66.66%> (-0.15%)` | :arrow_down: | | [libp2p/protocols/pubsub/pubsubpeer.nim](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1027?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im#diff-bGlicDJwL3Byb3RvY29scy9wdWJzdWIvcHVic3VicGVlci5uaW0=) | `93.72% <93.75%> (+0.22%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1027/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im)
arnetheduck commented 7 months ago

this is a good idea - in fact, it should be extended so that it also skips messages that were sent by the other node "in full" while queued.

Basically, a peer can tell us they have the message already in two ways: by IDONTWANT and by sending the message in its entirety.

The latter is quite possible: because low-prio messages are the ones being forwarded across the network in bursts, it's possible we receive (a duplicate of) it from the peer while sending some other message.