Handle dial AlreadyConnected
error via retries or state modification #225
Open
Description
Because of the async nature of our code, it is entirely possible that:
- we try to dial a peer that is already connected
- the dialing happens before a
ConnectionEstablished
event is received
At the moment, this is affecting the request-response and notification protocols.
Instead of returning an immediate error, try to cache the request or state of negotiation and submit it when the connection is reported via events.
Code examples:
litep2p/src/protocol/request_response/mod.rs
Line 728 in 10aa306
litep2p/src/protocol/notification/mod.rs
Line 937 in 10aa306
Discovered during: #222