Skip to content

Commit 429e5b8

Browse files
committed
Add logging to proxy server
1 parent d50ec6b commit 429e5b8

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/qos_net/src/proxy.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ impl Proxy {
194194

195195
impl server::RequestProcessor for Proxy {
196196
fn process(&mut self, req_bytes: Vec<u8>) -> Vec<u8> {
197+
println!("Proxy processing request");
197198
if req_bytes.len() > MAX_ENCODED_MSG_LEN {
198199
return ProxyMsg::ProxyError(QosNetError::OversizedPayload)
199200
.try_to_vec()
@@ -203,32 +204,41 @@ impl server::RequestProcessor for Proxy {
203204
let resp = match ProxyMsg::try_from_slice(&req_bytes) {
204205
Ok(req) => match req {
205206
ProxyMsg::StatusRequest => {
207+
println!("Proxy processing StatusRequest");
206208
ProxyMsg::StatusResponse(self.connections.len())
207209
}
208210
ProxyMsg::ConnectByNameRequest {
209211
hostname,
210212
port,
211213
dns_resolvers,
212214
dns_port,
213-
} => self.connect_by_name(
214-
hostname,
215-
port,
216-
dns_resolvers,
217-
dns_port,
218-
),
215+
} => {
216+
println!("Proxy connecting to {hostname}:{port}");
217+
self.connect_by_name(
218+
hostname,
219+
port,
220+
dns_resolvers,
221+
dns_port,
222+
)
223+
},
219224
ProxyMsg::ConnectByIpRequest { ip, port } => {
225+
println!("Proxy connecting to {ip}:{port}");
220226
self.connect_by_ip(ip, port)
221227
}
222228
ProxyMsg::CloseRequest { connection_id } => {
229+
println!("Proxy closing connection {connection_id}");
223230
self.close(connection_id)
224231
}
225232
ProxyMsg::ReadRequest { connection_id, size } => {
233+
println!("Proxy reading {size} bytes from connection {connection_id}");
226234
self.read(connection_id, size)
227235
}
228236
ProxyMsg::WriteRequest { connection_id, data } => {
237+
println!("Proxy writing to connection {connection_id}");
229238
self.write(connection_id, data)
230239
}
231240
ProxyMsg::FlushRequest { connection_id } => {
241+
println!("Proxy flushing connection {connection_id}");
232242
self.flush(connection_id)
233243
}
234244
ProxyMsg::ProxyError(_) => {

0 commit comments

Comments
 (0)