-
Notifications
You must be signed in to change notification settings - Fork 993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support explicit addresses for dialing purposes send_request
#5634
Comments
Hi Nazar, you are referring to
how would this work if |
Yes, what I meant is that for this to include addresses: rust-libp2p/protocols/request-response/src/lib.rs Lines 434 to 436 in d3228ad
Like this: self.pending_events.push_back(ToSwarm::Dial {
opts: DialOpts::peer_id(*peer).addresses(addresses).build(),
}); |
I am curious, where do those multiaddresses come from? And can't you dial them as soon as you get them? |
Not sure what you mean by that exactly |
Sorry Nazar, I misread, reformulated the question |
I have a custom request-response protocol, then as described in #5626 if responder doesn't have the data they respond with addresses of closest peers via local Kademlia query. After this application aggregates results and if needed makes requests to some of the newly discovered peers, which swarm may not be aware of at all. |
Right now
send_request
is dialing peer ID unconditionally. It is destined to fail if none of the behaviors know the address of the peer, as documented in the method itself.However I am getting addresses in a response to another request and don't really want to persist it in any of the behaviors due to how annoying it is to write and manage them.
The simplest change that would work for me is to add an optional list of addresses to
send_request
, such that it can still succeed even if behaviors know nothing about this peer.Not sure if this is the desired approach though. Initially I tried to initiate explicit dial right before calling
send_request
, but it didn't work becausesend_request
's dial quickly fails and aborts the whole request, so I'll need to do more elaborate workaround, which is unfortunate and unnecessary.The text was updated successfully, but these errors were encountered: