public address detection work
This commit is contained in:
@@ -188,7 +188,7 @@ impl IGDManager {
|
||||
}
|
||||
}
|
||||
let pmk = found?;
|
||||
let pmv = inner.port_maps.remove(&pmk).unwrap();
|
||||
let _pmv = inner.port_maps.remove(&pmk).expect("key found but remove failed");
|
||||
|
||||
// Find gateway
|
||||
let gw = Self::find_gateway(&mut *inner, at)?;
|
||||
|
@@ -213,7 +213,7 @@ impl DiscoveryContext {
|
||||
|
||||
#[instrument(level = "trace", skip(self), ret)]
|
||||
async fn try_port_mapping(&self) -> Option<DialInfo> {
|
||||
let (enable_upnp, enable_natpmp) = {
|
||||
let (enable_upnp, _enable_natpmp) = {
|
||||
let c = self.net.config.get();
|
||||
(c.network.upnp, c.network.natpmp)
|
||||
};
|
||||
|
@@ -113,7 +113,7 @@ impl Network {
|
||||
let addr = match tcp_stream.peer_addr() {
|
||||
Ok(addr) => addr,
|
||||
Err(e) => {
|
||||
log_net!(error "failed to get peer address: {}", e);
|
||||
log_net!(debug "failed to get peer address: {}", e);
|
||||
return;
|
||||
}
|
||||
};
|
||||
@@ -139,7 +139,7 @@ impl Network {
|
||||
{
|
||||
// If we fail to get a packet within the connection initial timeout
|
||||
// then we punt this connection
|
||||
log_net!(warn "connection initial timeout from: {:?}", addr);
|
||||
log_net!("connection initial timeout from: {:?}", addr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -169,12 +169,12 @@ impl Network {
|
||||
}
|
||||
Ok(None) => {
|
||||
// No protocol handlers matched? drop it.
|
||||
log_net!(warn "no protocol handler for connection from {:?}", addr);
|
||||
log_net!(debug "no protocol handler for connection from {:?}", addr);
|
||||
return;
|
||||
}
|
||||
Err(e) => {
|
||||
// Failed to negotiate connection? drop it.
|
||||
log_net!(warn "failed to negotiate connection from {:?}: {}", addr, e);
|
||||
log_net!(debug "failed to negotiate connection from {:?}: {}", addr, e);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@@ -69,11 +69,15 @@ impl RawTcpNetworkConnection {
|
||||
|
||||
network_result_try!(stream.read_exact(&mut header).await.into_network_result()?);
|
||||
if header[0] != b'V' || header[1] != b'L' {
|
||||
bail_io_error_other!("received invalid TCP frame header");
|
||||
return Ok(NetworkResult::invalid_message(
|
||||
"received invalid TCP frame header",
|
||||
));
|
||||
}
|
||||
let len = ((header[3] as usize) << 8) | (header[2] as usize);
|
||||
if len > MAX_MESSAGE_SIZE {
|
||||
bail_io_error_other!("received too large TCP frame");
|
||||
return Ok(NetworkResult::invalid_message(
|
||||
"received too large TCP frame",
|
||||
));
|
||||
}
|
||||
|
||||
let mut out: Vec<u8> = vec![0u8; len];
|
||||
|
Reference in New Issue
Block a user