Add targetted logging for sneaky sync bug

This commit is contained in:
Age Manning
2020-01-17 13:12:00 +11:00
parent 0e3e2bbbe7
commit 0cd7ae56a6
2 changed files with 19 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ use libp2p::core::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeError};
use libp2p::swarm::protocols_handler::{
KeepAlive, ProtocolsHandler, ProtocolsHandlerEvent, ProtocolsHandlerUpgrErr, SubstreamProtocol,
};
use slog::{crit, debug, error};
use slog::{crit, debug, error, warn};
use smallvec::SmallVec;
use std::collections::hash_map::Entry;
use std::time::{Duration, Instant};
@@ -314,8 +314,12 @@ where
substream: out,
request,
};
self.outbound_substreams
.insert(id, (awaiting_stream, delay_key));
if let Some(_) = self
.outbound_substreams
.insert(id, (awaiting_stream, delay_key))
{
warn!(self.log, "Duplicate outbound substream id"; "id" => format!("{:?}", id));
}
}
_ => { // a response is not expected, drop the stream for all other requests
}