Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: Eloi DEMOLIS <[email protected]>
  • Loading branch information
Wonshtrum committed Oct 20, 2023
1 parent 7d3662c commit f362837
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/src/protocol/kawa_h1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ impl<Front: SocketHandler, L: ListenerHandler + L7ListenerHandler> Http<Front, L
self.context.keep_alive_frontend = true;
self.context.keep_alive_backend = true;
self.context.sticky_session_found = None;
self.context.method = None;
self.context.authority = None;
self.context.path = None;
self.context.status = None;
self.context.reason = None;
self.context.user_agent = None;
self.context.id = Ulid::generate();

self.request_stream.clear();
Expand Down Expand Up @@ -782,6 +788,8 @@ impl<Front: SocketHandler, L: ListenerHandler + L7ListenerHandler> Http<Front, L
}
pub fn log_request_error(&mut self, metrics: &mut SessionMetrics, message: &str) {
incr!("http.errors");
self.print_state("ACCESS-DEBUG");
warn!("=====acces_log_error:{}", message);
self.log_request(metrics, Some(message));
}

Expand Down Expand Up @@ -1377,12 +1385,12 @@ impl<Front: SocketHandler, L: ListenerHandler + L7ListenerHandler> Http<Front, L
&& self.backend_readiness.interest.is_readable()
{
// there might still data we can read on the socket
// println!("=====backend_hup:continue");
warn!("=====backend_hup:continue");
return StateResult::Continue;
}
if self.response_stream.is_terminated() {
// the backend finished to answer we can close
// println!("=====backend_hup:terminated");
warn!("=====backend_hup:terminated");
return StateResult::CloseBackend;
}
match (
Expand All @@ -1391,17 +1399,17 @@ impl<Front: SocketHandler, L: ListenerHandler + L7ListenerHandler> Http<Front, L
) {
// the backend started to answer so we close
(_, false) => {
// println!("=====backend_hup:close");
warn!("=====backend_hup:close");
StateResult::CloseSession
}
// probably backend hup between keep alive request, change backend
(true, true) => {
// println!("=====backend_hup:close_backend");
warn!("=====backend_hup:close_backend");
StateResult::CloseBackend
}
// the frontend already transmitted data so we can't redirect
(false, true) => {
// println!("=====backend_hup:503");
warn!("=====backend_hup:503");
self.set_answer(DefaultAnswerStatus::Answer503, None);
self.backend_readiness.interest = Ready::EMPTY;
StateResult::Continue
Expand Down
1 change: 1 addition & 0 deletions lib/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ impl SocketHandler for FrontRustls {

match self.session.read_tls(&mut self.stream) {
Ok(0) => {
warn!("=====read_tls:OK(0)");
can_read = false;
is_closed = true;
}
Expand Down

0 comments on commit f362837

Please sign in to comment.