Skip to content

Serve multiple Kademlia requests on one inbound substream - #647

Open
dharjeezy wants to merge 2 commits into
paritytech:masterfrom
dharjeezy:dami/kad-reuse-inbound-substreams
Open

dharjeezy wants to merge 2 commits into
paritytech:masterfrom
dharjeezy:dami/kad-reuse-inbound-substreams

Conversation

@dharjeezy

@dharjeezy dharjeezy commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

The Kademlia spec requires implementations to handle further requests on a substream a peer alreadysent one on, and litep2p was closing it after the first response, which is why go-libp2p keepslosing its cached stream mid conversation. Substreams the remote opened now go back to reading oncethe response is written, reusing the existing 15s read timeout as the idle window, andADD_PROVIDER no longer drops the substream just because the spec gives it no reply. A failure onone of those substreams is also no longer treated as the peer disconnecting, which previously failed every outbound query in flight with that peer whenever an inbound substream timed out.

Closes #467

@lexnv
lexnv requested review from dmitry-markin and lexnv and removed request for dmitry-markin August 24, 2026 09:34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kad: Support long-lived inbound substreams reused for multiple requests

1 participant