From 54d04a4a5bcd0d75ea8c274cde2ec6bc01d8ece7 Mon Sep 17 00:00:00 2001 From: Eloi DEMOLIS Date: Mon, 22 Apr 2024 14:13:35 +0200 Subject: [PATCH] Remove debugging println Signed-off-by: Eloi DEMOLIS --- bin/config.toml | 3 ++- lib/src/https.rs | 12 ++++++------ lib/src/protocol/mux/h1.rs | 8 ++++---- lib/src/protocol/mux/mod.rs | 10 +++++----- lib/src/router/mod.rs | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/bin/config.toml b/bin/config.toml index a37fbaf76..c144e520f 100644 --- a/bin/config.toml +++ b/bin/config.toml @@ -324,7 +324,8 @@ frontends = [ # - weight: weight used by the load balancing algorithm # - sticky-id: sticky session identifier backends = [ - { address = "127.0.0.1:1026", backend_id = "the-backend-to-my-app" } + { address = "127.0.0.1:1026", backend_id = "back26" }, + { address = "127.0.0.1:1027", backend_id = "back27" } ] # this is an example of a routing configuration for the TCP proxy diff --git a/lib/src/https.rs b/lib/src/https.rs index 3bf7569a4..086296178 100644 --- a/lib/src/https.rs +++ b/lib/src/https.rs @@ -272,7 +272,7 @@ impl HttpsSession { // Some client don't fill in the ALPN protocol, in this case we default to Http/1.1 None => AlpnProtocol::Http11, }; - println!("ALPN: {alpn:?}"); + // println!("ALPN: {alpn:?}"); if let Some(version) = handshake.session.protocol_version() { incr!(rustls_version_str(version)); @@ -480,23 +480,23 @@ impl ProxySession for HttpsSession { token, super::ready_to_string(events) ); - println!("EVENT: {token:?}->{events:?}"); + // println!("EVENT: {token:?}->{events:?}"); self.last_event = Instant::now(); self.metrics.wait_start(); self.state.update_readiness(token, events); } fn ready(&mut self, session: Rc>) -> SessionIsToBeClosed { - let start = std::time::Instant::now(); - println!("READY {start:?}"); + // let start = std::time::Instant::now(); + // println!("READY {start:?}"); self.metrics.service_start(); let session_result = self.state .ready(session.clone(), self.proxy.clone(), &mut self.metrics); - let end = std::time::Instant::now(); - println!("READY END {end:?} -> {:?}", end.duration_since(start)); + // let end = std::time::Instant::now(); + // println!("READY END {end:?} -> {:?}", end.duration_since(start)); let to_be_closed = match session_result { SessionResult::Close => true, diff --git a/lib/src/protocol/mux/h1.rs b/lib/src/protocol/mux/h1.rs index 0ed80a03f..9fb52aa86 100644 --- a/lib/src/protocol/mux/h1.rs +++ b/lib/src/protocol/mux/h1.rs @@ -49,7 +49,7 @@ impl ConnectionH1 { return MuxResult::Continue; } - let was_initial = kawa.is_initial(); + let was_main_phase = kawa.is_main_phase(); kawa::h1::parse(kawa, parts.context); debug_kawa(kawa); if kawa.is_error() { @@ -80,7 +80,7 @@ impl ConnectionH1 { } match self.position { Position::Server => { - if was_initial { + if !was_main_phase { self.requests += 1; println_!("REQUESTS: {}", self.requests); stream.state = StreamState::Link @@ -153,9 +153,9 @@ impl ConnectionH1 { let old_state = std::mem::replace(&mut stream.state, StreamState::Unlinked); if stream.context.keep_alive_frontend { self.timeout_container.reset(); - println!("{old_state:?} {:?}", self.readiness); + // println!("{old_state:?} {:?}", self.readiness); if let StreamState::Linked(token) = old_state { - println!("{:?}", endpoint.readiness(token)); + // println!("{:?}", endpoint.readiness(token)); endpoint.end_stream(token, self.stream, context); } self.readiness.interest.insert(Ready::READABLE); diff --git a/lib/src/protocol/mux/mod.rs b/lib/src/protocol/mux/mod.rs index 8f6d9dad3..e048af372 100644 --- a/lib/src/protocol/mux/mod.rs +++ b/lib/src/protocol/mux/mod.rs @@ -1,7 +1,7 @@ use std::{ cell::RefCell, collections::HashMap, - io::{ErrorKind, Write}, + io::ErrorKind, net::{Shutdown, SocketAddr}, rc::{Rc, Weak}, time::Duration, @@ -42,7 +42,7 @@ use self::h2::Prioriser; macro_rules! println_ { ($($t:expr),*) => { // print!("{}:{} ", file!(), line!()); - println!($($t),*) + // println!($($t),*) // $(let _ = &$t;)* }; } @@ -942,7 +942,7 @@ impl SessionState for Mux { let mut dead_backends = Vec::new(); for (token, backend) in self.router.backends.iter_mut() { let readiness = backend.readiness_mut(); - println!("{token:?} -> {readiness:?}"); + // println!("{token:?} -> {readiness:?}"); let dead = readiness.filter_interest().is_hup() || readiness.filter_interest().is_error(); if dead { @@ -1011,7 +1011,7 @@ impl SessionState for Mux { if !proxy_borrow.remove_session(*token) { error!("session {:?} was already removed!", token); } else { - println!("SUCCESS: session {token:?} was removed!"); + // println!("SUCCESS: session {token:?} was removed!"); } } println_!("FRONTEND: {:#?}", self.frontend); @@ -1257,7 +1257,7 @@ impl SessionState for Mux { if !proxy_borrow.remove_session(*token) { error!("session {:?} was already removed!", token); } else { - println!("SUCCESS: session {token:?} was removed!"); + // println!("SUCCESS: session {token:?} was removed!"); } } // let s = match &mut self.frontend { diff --git a/lib/src/router/mod.rs b/lib/src/router/mod.rs index 06c5b453d..b50b76d1c 100644 --- a/lib/src/router/mod.rs +++ b/lib/src/router/mod.rs @@ -936,7 +936,7 @@ mod tests { ), Ok(Route::Cluster { id: "examplewildcard".to_string(), - h2: true + h2: false }) ); assert_eq!(