mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-01-11 07:19:26 -05:00
log cleanup
This commit is contained in:
parent
a44794ab98
commit
6753fe01a1
@ -814,7 +814,7 @@ impl NetworkManager {
|
|||||||
|
|
||||||
// Send receipt directly
|
// Send receipt directly
|
||||||
log_net!(debug "send_out_of_band_receipt: dial_info={}", dial_info);
|
log_net!(debug "send_out_of_band_receipt: dial_info={}", dial_info);
|
||||||
network_result_value_or_log!(debug self
|
network_result_value_or_log!(self
|
||||||
.net()
|
.net()
|
||||||
.send_data_unbound_to_dial_info(dial_info, rcpt_data)
|
.send_data_unbound_to_dial_info(dial_info, rcpt_data)
|
||||||
.await? => {
|
.await? => {
|
||||||
@ -1243,7 +1243,7 @@ impl NetworkManager {
|
|||||||
let timeout_ms = self.with_config(|c| c.network.rpc.timeout_ms);
|
let timeout_ms = self.with_config(|c| c.network.rpc.timeout_ms);
|
||||||
// Send boot magic to requested peer address
|
// Send boot magic to requested peer address
|
||||||
let data = BOOT_MAGIC.to_vec();
|
let data = BOOT_MAGIC.to_vec();
|
||||||
let out_data: Vec<u8> = network_result_value_or_log!(debug self
|
let out_data: Vec<u8> = network_result_value_or_log!(self
|
||||||
.net()
|
.net()
|
||||||
.send_recv_data_unbound_to_dial_info(dial_info, data, timeout_ms)
|
.send_recv_data_unbound_to_dial_info(dial_info, data, timeout_ms)
|
||||||
.await? =>
|
.await? =>
|
||||||
@ -1315,13 +1315,13 @@ impl NetworkManager {
|
|||||||
|
|
||||||
// Is this a direct bootstrap request instead of an envelope?
|
// Is this a direct bootstrap request instead of an envelope?
|
||||||
if data[0..4] == *BOOT_MAGIC {
|
if data[0..4] == *BOOT_MAGIC {
|
||||||
network_result_value_or_log!(debug self.handle_boot_request(connection_descriptor).await? => {});
|
network_result_value_or_log!(self.handle_boot_request(connection_descriptor).await? => {});
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is this an out-of-band receipt instead of an envelope?
|
// Is this an out-of-band receipt instead of an envelope?
|
||||||
if data[0..4] == *RECEIPT_MAGIC {
|
if data[0..4] == *RECEIPT_MAGIC {
|
||||||
network_result_value_or_log!(debug self.handle_out_of_band_receipt(data).await => {});
|
network_result_value_or_log!(self.handle_out_of_band_receipt(data).await => {});
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1396,7 +1396,7 @@ impl NetworkManager {
|
|||||||
if let Some(relay_nr) = some_relay_nr {
|
if let Some(relay_nr) = some_relay_nr {
|
||||||
// Relay the packet to the desired destination
|
// Relay the packet to the desired destination
|
||||||
log_net!("relaying {} bytes to {}", data.len(), relay_nr);
|
log_net!("relaying {} bytes to {}", data.len(), relay_nr);
|
||||||
network_result_value_or_log!(debug self.send_data(relay_nr, data.to_vec())
|
network_result_value_or_log!(self.send_data(relay_nr, data.to_vec())
|
||||||
.await
|
.await
|
||||||
.wrap_err("failed to forward envelope")? => {
|
.wrap_err("failed to forward envelope")? => {
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
|
@ -512,7 +512,7 @@ impl Network {
|
|||||||
&peer_socket_addr,
|
&peer_socket_addr,
|
||||||
&descriptor.local().map(|sa| sa.to_socket_addr()),
|
&descriptor.local().map(|sa| sa.to_socket_addr()),
|
||||||
) {
|
) {
|
||||||
network_result_value_or_log!(debug ph.clone()
|
network_result_value_or_log!(ph.clone()
|
||||||
.send_message(data.clone(), peer_socket_addr)
|
.send_message(data.clone(), peer_socket_addr)
|
||||||
.await
|
.await
|
||||||
.wrap_err("sending data to existing conection")? => { return Ok(Some(data)); } );
|
.wrap_err("sending data to existing conection")? => { return Ok(Some(data)); } );
|
||||||
|
@ -83,7 +83,7 @@ impl DiscoveryContext {
|
|||||||
async fn request_public_address(&self, node_ref: NodeRef) -> Option<SocketAddress> {
|
async fn request_public_address(&self, node_ref: NodeRef) -> Option<SocketAddress> {
|
||||||
let rpc = self.routing_table.rpc_processor();
|
let rpc = self.routing_table.rpc_processor();
|
||||||
|
|
||||||
let res = network_result_value_or_log!(debug match rpc.rpc_call_status(Destination::direct(node_ref.clone())).await {
|
let res = network_result_value_or_log!(match rpc.rpc_call_status(Destination::direct(node_ref.clone())).await {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log_net!(error
|
log_net!(error
|
||||||
|
@ -14,7 +14,7 @@ impl RawUdpProtocolHandler {
|
|||||||
// #[instrument(level = "trace", err, skip(self, data), fields(data.len = data.len(), ret.len, ret.descriptor))]
|
// #[instrument(level = "trace", err, skip(self, data), fields(data.len = data.len(), ret.len, ret.descriptor))]
|
||||||
pub async fn recv_message(&self, data: &mut [u8]) -> io::Result<(usize, ConnectionDescriptor)> {
|
pub async fn recv_message(&self, data: &mut [u8]) -> io::Result<(usize, ConnectionDescriptor)> {
|
||||||
let (size, descriptor) = loop {
|
let (size, descriptor) = loop {
|
||||||
let (size, remote_addr) = network_result_value_or_log!(debug self.socket.recv_from(data).await.into_network_result()? => continue);
|
let (size, remote_addr) = network_result_value_or_log!(self.socket.recv_from(data).await.into_network_result()? => continue);
|
||||||
if size > MAX_MESSAGE_SIZE {
|
if size > MAX_MESSAGE_SIZE {
|
||||||
log_net!(debug "{}({}) at {}@{}:{}", "Invalid message".green(), "received too large UDP message", file!(), line!(), column!());
|
log_net!(debug "{}({}) at {}@{}:{}", "Invalid message".green(), "received too large UDP message", file!(), line!(), column!());
|
||||||
continue;
|
continue;
|
||||||
|
@ -301,7 +301,7 @@ impl NetworkConnection {
|
|||||||
match res {
|
match res {
|
||||||
Ok(v) => {
|
Ok(v) => {
|
||||||
|
|
||||||
let message = network_result_value_or_log!(debug v => {
|
let message = network_result_value_or_log!(v => {
|
||||||
return RecvLoopAction::Finish;
|
return RecvLoopAction::Finish;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -891,7 +891,7 @@ impl RoutingTable {
|
|||||||
// and then contact those nodes to inform -them- that we exist
|
// and then contact those nodes to inform -them- that we exist
|
||||||
|
|
||||||
// Ask bootstrap server for nodes closest to our own node
|
// Ask bootstrap server for nodes closest to our own node
|
||||||
let closest_nodes = network_result_value_or_log!(debug match self.find_self(node_ref.clone()).await {
|
let closest_nodes = network_result_value_or_log!(match self.find_self(node_ref.clone()).await {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log_rtab!(error
|
log_rtab!(error
|
||||||
"find_self failed for {:?}: {:?}",
|
"find_self failed for {:?}: {:?}",
|
||||||
@ -907,7 +907,7 @@ impl RoutingTable {
|
|||||||
// Ask each node near us to find us as well
|
// Ask each node near us to find us as well
|
||||||
if wide {
|
if wide {
|
||||||
for closest_nr in closest_nodes {
|
for closest_nr in closest_nodes {
|
||||||
network_result_value_or_log!(debug match self.find_self(closest_nr.clone()).await {
|
network_result_value_or_log!(match self.find_self(closest_nr.clone()).await {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log_rtab!(error
|
log_rtab!(error
|
||||||
"find_self failed for {:?}: {:?}",
|
"find_self failed for {:?}: {:?}",
|
||||||
|
@ -1344,13 +1344,8 @@ impl RPCProcessor {
|
|||||||
|
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
};
|
};
|
||||||
cfg_if::cfg_if! {
|
|
||||||
if #[cfg(debug_assertions)] {
|
network_result_value_or_log!(res => {});
|
||||||
network_result_value_or_log!(warn res => {});
|
|
||||||
} else {
|
|
||||||
network_result_value_or_log!(debug res => {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ impl RPCProcessor {
|
|||||||
|
|
||||||
// Send the validate_dial_info request
|
// Send the validate_dial_info request
|
||||||
// This can only be sent directly, as relays can not validate dial info
|
// This can only be sent directly, as relays can not validate dial info
|
||||||
network_result_value_or_log!(debug self.statement(Destination::direct(peer), statement)
|
network_result_value_or_log!(self.statement(Destination::direct(peer), statement)
|
||||||
.await? => {
|
.await? => {
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ impl RPCProcessor {
|
|||||||
|
|
||||||
// Send the validate_dial_info request
|
// Send the validate_dial_info request
|
||||||
// This can only be sent directly, as relays can not validate dial info
|
// This can only be sent directly, as relays can not validate dial info
|
||||||
network_result_value_or_log!(debug self.statement(Destination::direct(peer), statement)
|
network_result_value_or_log!(self.statement(Destination::direct(peer), statement)
|
||||||
.await? => {
|
.await? => {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1474,8 +1474,8 @@ class VeilidStateRoute {
|
|||||||
});
|
});
|
||||||
|
|
||||||
VeilidStateRoute.fromJson(Map<String, dynamic> json)
|
VeilidStateRoute.fromJson(Map<String, dynamic> json)
|
||||||
: deadRoutes = jsonDecode(json['dead_routes']),
|
: deadRoutes = json['dead_routes'],
|
||||||
deadRemoteRoutes = jsonDecode(json['dead_remote_routes']);
|
deadRemoteRoutes = json['dead_remote_routes'];
|
||||||
|
|
||||||
Map<String, dynamic> get json {
|
Map<String, dynamic> get json {
|
||||||
return {'dead_routes': deadRoutes, 'dead_remote_routes': deadRemoteRoutes};
|
return {'dead_routes': deadRoutes, 'dead_remote_routes': deadRemoteRoutes};
|
||||||
|
@ -328,7 +328,7 @@ macro_rules! log_network_result {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! network_result_value_or_log {
|
macro_rules! network_result_value_or_log {
|
||||||
($level: ident $r: expr => $f:tt) => {
|
($r: expr => $f:tt) => {
|
||||||
match $r {
|
match $r {
|
||||||
NetworkResult::Timeout => {
|
NetworkResult::Timeout => {
|
||||||
log_network_result!(
|
log_network_result!(
|
||||||
|
Loading…
Reference in New Issue
Block a user