Skip to content

Commit

Permalink
Remove debugging println
Browse files Browse the repository at this point in the history
Signed-off-by: Eloi DEMOLIS <[email protected]>
  • Loading branch information
Wonshtrum committed May 6, 2024
1 parent faac102 commit 54d04a4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
3 changes: 2 additions & 1 deletion bin/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions lib/src/https.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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<RefCell<dyn ProxySession>>) -> 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,
Expand Down
8 changes: 4 additions & 4 deletions lib/src/protocol/mux/h1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<Front: SocketHandler> ConnectionH1<Front> {
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() {
Expand Down Expand Up @@ -80,7 +80,7 @@ impl<Front: SocketHandler> ConnectionH1<Front> {
}
match self.position {
Position::Server => {
if was_initial {
if !was_main_phase {
self.requests += 1;
println_!("REQUESTS: {}", self.requests);
stream.state = StreamState::Link
Expand Down Expand Up @@ -153,9 +153,9 @@ impl<Front: SocketHandler> ConnectionH1<Front> {
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);
Expand Down
10 changes: 5 additions & 5 deletions lib/src/protocol/mux/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{
cell::RefCell,
collections::HashMap,
io::{ErrorKind, Write},
io::ErrorKind,
net::{Shutdown, SocketAddr},
rc::{Rc, Weak},
time::Duration,
Expand Down Expand Up @@ -42,7 +42,7 @@ use self::h2::Prioriser;
macro_rules! println_ {
($($t:expr),*) => {
// print!("{}:{} ", file!(), line!());
println!($($t),*)
// println!($($t),*)
// $(let _ = &$t;)*
};
}
Expand Down Expand Up @@ -942,7 +942,7 @@ impl<Front: SocketHandler + std::fmt::Debug> SessionState for Mux<Front> {
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 {
Expand Down Expand Up @@ -1011,7 +1011,7 @@ impl<Front: SocketHandler + std::fmt::Debug> SessionState for Mux<Front> {
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);
Expand Down Expand Up @@ -1257,7 +1257,7 @@ impl<Front: SocketHandler + std::fmt::Debug> SessionState for Mux<Front> {
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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ mod tests {
),
Ok(Route::Cluster {
id: "examplewildcard".to_string(),
h2: true
h2: false
})
);
assert_eq!(
Expand Down

0 comments on commit 54d04a4

Please sign in to comment.