From 595349dc2d635e5759256d38f3aae9b3866cfe93 Mon Sep 17 00:00:00 2001 From: Arnaud Brousseau Date: Mon, 24 Jun 2024 12:36:43 -0500 Subject: [PATCH] Add logging to proxy server --- src/qos_net/src/proxy.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/qos_net/src/proxy.rs b/src/qos_net/src/proxy.rs index 809ae2a1..d5cde7d5 100644 --- a/src/qos_net/src/proxy.rs +++ b/src/qos_net/src/proxy.rs @@ -194,6 +194,7 @@ impl Proxy { impl server::RequestProcessor for Proxy { fn process(&mut self, req_bytes: Vec) -> Vec { + println!("Proxy processing request"); if req_bytes.len() > MAX_ENCODED_MSG_LEN { return ProxyMsg::ProxyError(QosNetError::OversizedPayload) .try_to_vec() @@ -203,6 +204,7 @@ impl server::RequestProcessor for Proxy { let resp = match ProxyMsg::try_from_slice(&req_bytes) { Ok(req) => match req { ProxyMsg::StatusRequest => { + println!("Proxy processing StatusRequest"); ProxyMsg::StatusResponse(self.connections.len()) } ProxyMsg::ConnectByNameRequest { @@ -210,25 +212,33 @@ impl server::RequestProcessor for Proxy { port, dns_resolvers, dns_port, - } => self.connect_by_name( - hostname, - port, - dns_resolvers, - dns_port, - ), + } => { + println!("Proxy connecting to {hostname}:{port}"); + self.connect_by_name( + hostname, + port, + dns_resolvers, + dns_port, + ) + }, ProxyMsg::ConnectByIpRequest { ip, port } => { + println!("Proxy connecting to {ip}:{port}"); self.connect_by_ip(ip, port) } ProxyMsg::CloseRequest { connection_id } => { + println!("Proxy closing connection {connection_id}"); self.close(connection_id) } ProxyMsg::ReadRequest { connection_id, size } => { + println!("Proxy reading {size} bytes from connection {connection_id}"); self.read(connection_id, size) } ProxyMsg::WriteRequest { connection_id, data } => { + println!("Proxy writing to connection {connection_id}"); self.write(connection_id, data) } ProxyMsg::FlushRequest { connection_id } => { + println!("Proxy flushing connection {connection_id}"); self.flush(connection_id) } ProxyMsg::ProxyError(_) => {