swarm/src/connection: Extend log when exceeding streams limit (#2716)

Log peer ID and stream limit as well as reference config option when limit is
exceeded. This should help folks running into this limit debug what is going on.
This commit is contained in:
Max Inden
2022-06-22 06:02:55 +02:00
committed by GitHub
parent e2bef93bd7
commit 7eaa9c7bb7
5 changed files with 29 additions and 7 deletions

View File

@ -35,6 +35,7 @@ pub use pool::{EstablishedConnection, PendingConnection};
pub use substream::{Close, Substream, SubstreamEndpoint};
use crate::handler::ConnectionHandler;
use crate::IntoConnectionHandler;
use handler_wrapper::HandlerWrapper;
use libp2p_core::connection::ConnectedPoint;
use libp2p_core::multiaddr::Multiaddr;
@ -94,12 +95,16 @@ where
/// Builds a new `Connection` from the given substream multiplexer
/// and connection handler.
pub fn new(
peer_id: PeerId,
endpoint: ConnectedPoint,
muxer: StreamMuxerBox,
handler: THandler,
handler: impl IntoConnectionHandler<Handler = THandler>,
substream_upgrade_protocol_override: Option<upgrade::Version>,
max_negotiating_inbound_streams: usize,
) -> Self {
let wrapped_handler = HandlerWrapper::new(
peer_id,
endpoint,
handler,
substream_upgrade_protocol_override,
max_negotiating_inbound_streams,