mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-25 21:17:17 +00:00
Increase UPnP logging and decrease batch sizes (#1812)
## Description This increases the logging of the underlying UPnP tasks to inform the user of UPnP error/success. This also decreases the batch syncing size to two epochs per batch.
This commit is contained in:
parent
c49dd94e20
commit
ae96dab5d2
@ -36,32 +36,39 @@ pub fn construct_upnp_mappings<T: EthSpec>(
|
|||||||
network_send: mpsc::UnboundedSender<NetworkMessage<T>>,
|
network_send: mpsc::UnboundedSender<NetworkMessage<T>>,
|
||||||
log: slog::Logger,
|
log: slog::Logger,
|
||||||
) {
|
) {
|
||||||
debug!(log, "UPnP Initialising routes");
|
info!(log, "UPnP Attempting to initialise routes");
|
||||||
match igd::search_gateway(Default::default()) {
|
match igd::search_gateway(Default::default()) {
|
||||||
Err(e) => debug!(log, "UPnP not available"; "error" => %e),
|
Err(e) => info!(log, "UPnP not available"; "error" => %e),
|
||||||
Ok(gateway) => {
|
Ok(gateway) => {
|
||||||
// Need to find the local listening address matched with the router subnet
|
// Need to find the local listening address matched with the router subnet
|
||||||
let mut local_ip = None;
|
|
||||||
let interfaces = match get_if_addrs() {
|
let interfaces = match get_if_addrs() {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!(log, "UPnP failed to get local interfaces"; "error" => %e);
|
info!(log, "UPnP failed to get local interfaces"; "error" => %e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for interface in interfaces {
|
let local_ip = interfaces.iter().find_map(|interface| {
|
||||||
// Just use the first IP of the first interface that is not a loopback
|
// Just use the first IP of the first interface that is not a loopback and not an
|
||||||
|
// ipv6 address.
|
||||||
if !interface.is_loopback() {
|
if !interface.is_loopback() {
|
||||||
local_ip = Some(interface.ip());
|
if let IpAddr::V4(_) = interface.ip() {
|
||||||
|
Some(interface.ip())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if local_ip.is_none() {
|
let local_ip = match local_ip {
|
||||||
debug!(log, "UPnP failed to find local IP address");
|
None => {
|
||||||
|
info!(log, "UPnP failed to find local IP address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Some(v) => v,
|
||||||
let local_ip = local_ip.expect("IP exists");
|
};
|
||||||
|
|
||||||
match local_ip {
|
match local_ip {
|
||||||
IpAddr::V4(address) => {
|
IpAddr::V4(address) => {
|
||||||
@ -79,7 +86,7 @@ pub fn construct_upnp_mappings<T: EthSpec>(
|
|||||||
"lighthouse-tcp",
|
"lighthouse-tcp",
|
||||||
) {
|
) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!(log, "UPnP could not construct libp2p port route"; "error" => %e);
|
info!(log, "UPnP TCP route not set"; "error" => %e);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
@ -101,7 +108,7 @@ pub fn construct_upnp_mappings<T: EthSpec>(
|
|||||||
"lighthouse-udp",
|
"lighthouse-udp",
|
||||||
) {
|
) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!(log, "UPnP could not construct discovery port route"; "error" => %e);
|
info!(log, "UPnP UDP route not set"; "error" => %e);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
|
@ -18,7 +18,7 @@ use types::{Epoch, EthSpec, Hash256, SignedBeaconBlock, Slot};
|
|||||||
/// we will negatively report peers with poor bandwidth. This can be set arbitrarily high, in which
|
/// we will negatively report peers with poor bandwidth. This can be set arbitrarily high, in which
|
||||||
/// case the responder will fill the response up to the max request size, assuming they have the
|
/// case the responder will fill the response up to the max request size, assuming they have the
|
||||||
/// bandwidth to do so.
|
/// bandwidth to do so.
|
||||||
pub const EPOCHS_PER_BATCH: u64 = 8;
|
pub const EPOCHS_PER_BATCH: u64 = 2;
|
||||||
|
|
||||||
/// The maximum number of batches to queue before requesting more.
|
/// The maximum number of batches to queue before requesting more.
|
||||||
const BATCH_BUFFER_SIZE: u8 = 5;
|
const BATCH_BUFFER_SIZE: u8 = 5;
|
||||||
|
Loading…
Reference in New Issue
Block a user