mirror of https://github.com/ospab/ostp.git
chore: reduce client and server logging verbosity for outbound datagrams and relays
This commit is contained in:
parent
8cfb7e9c17
commit
2870569c55
|
|
@ -614,12 +614,10 @@ impl Bridge {
|
||||||
Ok(ProtocolAction::SendDatagram(frame)) => {
|
Ok(ProtocolAction::SendDatagram(frame)) => {
|
||||||
if send_datagram(&session.socket, &frame, self.transport_mode == "udp" ).await.is_ok() {
|
if send_datagram(&session.socket, &frame, self.transport_mode == "udp" ).await.is_ok() {
|
||||||
self.metrics.bytes_sent.fetch_add(frame.len() as u64, Ordering::Relaxed);
|
self.metrics.bytes_sent.fetch_add(frame.len() as u64, Ordering::Relaxed);
|
||||||
if self.debug {
|
tracing::trace!(
|
||||||
let _ = tx.send(UiEvent::Log(format!(
|
"Outbound datagram sent stream_id={stream_id} bytes={}",
|
||||||
"Outbound datagram sent stream_id={stream_id} bytes={}",
|
frame.len()
|
||||||
frame.len()
|
);
|
||||||
))).await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(ProtocolAction::Multiple(list)) => {
|
Ok(ProtocolAction::Multiple(list)) => {
|
||||||
|
|
@ -632,25 +630,19 @@ impl Bridge {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if self.debug {
|
tracing::trace!(
|
||||||
let _ = tx.send(UiEvent::Log(format!(
|
"Outbound datagram batch stream_id={stream_id} sent={sent}"
|
||||||
"Outbound datagram batch stream_id={stream_id} sent={sent}"
|
);
|
||||||
))).await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(ProtocolAction::Noop) => {
|
Ok(ProtocolAction::Noop) => {
|
||||||
if self.debug {
|
tracing::trace!(
|
||||||
let _ = tx.send(UiEvent::Log(format!(
|
"Outbound datagram noop stream_id={stream_id}"
|
||||||
"Outbound datagram noop stream_id={stream_id}"
|
);
|
||||||
))).await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
if self.debug {
|
tracing::trace!(
|
||||||
let _ = tx.send(UiEvent::Log(format!(
|
"Outbound datagram unexpected action stream_id={stream_id}"
|
||||||
"Outbound datagram unexpected action stream_id={stream_id}"
|
);
|
||||||
))).await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::warn!("Protocol error packing outbound stream_id={}: {}", stream_id, e);
|
tracing::warn!("Protocol error packing outbound stream_id={}: {}", stream_id, e);
|
||||||
|
|
|
||||||
|
|
@ -289,8 +289,6 @@ pub async fn run_server(
|
||||||
|| msg.starts_with("Listening")
|
|| msg.starts_with("Listening")
|
||||||
|| msg.starts_with("Shutdown")
|
|| msg.starts_with("Shutdown")
|
||||||
|| msg.starts_with("Session ")
|
|| msg.starts_with("Session ")
|
||||||
|| msg.starts_with("Relay CONNECT")
|
|
||||||
|| msg.starts_with("Relay CLOSE")
|
|
||||||
|| msg.starts_with("Relay error");
|
|| msg.starts_with("Relay error");
|
||||||
if debug || is_essential {
|
if debug || is_essential {
|
||||||
tracing::info!("{msg}");
|
tracing::info!("{msg}");
|
||||||
|
|
@ -592,7 +590,7 @@ async fn run_server_loop(
|
||||||
let _ = ui_event_tx.send(UiEvent::Log(format!("Relay CONNECT ok for [{session_id}:{stream_id}] -> {target}")));
|
let _ = ui_event_tx.send(UiEvent::Log(format!("Relay CONNECT ok for [{session_id}:{stream_id}] -> {target}")));
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let _ = ui_event_tx.send(UiEvent::Log(format!("Relay CONNECT failed for [{session_id}:{stream_id}] -> {target}: {err}")));
|
let _ = ui_event_tx.send(UiEvent::Log(format!("Relay error: CONNECT failed for [{session_id}:{stream_id}] -> {target}: {err}")));
|
||||||
let _ = relay::send_relay_to_stream(session_id, stream_id, RelayMessage::Error(format!("connect failed: {err}")), &mut dispatcher, &socket, &ui_event_tx, &tcp_map).await;
|
let _ = relay::send_relay_to_stream(session_id, stream_id, RelayMessage::Error(format!("connect failed: {err}")), &mut dispatcher, &socket, &ui_event_tx, &tcp_map).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue