Skip to content

Commit

Permalink
return a HTTP 503 error when there are too many connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal authored and FlorentinDUBOIS committed Jul 13, 2022
1 parent 4806fa1 commit a82a83f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ impl Session {
>= self.proxy.borrow().sessions.borrow().slab_capacity()
{
error!("not enough memory, cannot connect to backend");
self.set_answer(DefaultAnswerStatus::Answer503, None);
return Err(ConnectionError::TooManyConnections);
}

Expand Down
1 change: 1 addition & 0 deletions lib/src/https_openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,7 @@ impl Session {
>= self.proxy.borrow().sessions.borrow().slab_capacity()
{
error!("not enough memory, cannot connect to backend");
self.set_answer(DefaultAnswerStatus::Answer503, None);
return Err(ConnectionError::TooManyConnections);
}

Expand Down
1 change: 1 addition & 0 deletions lib/src/https_rustls/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,7 @@ impl Session {
>= self.proxy.borrow().sessions.borrow().slab_capacity()
{
error!("not enough memory, cannot connect to backend");
self.set_answer(DefaultAnswerStatus::Answer503, None);
return Err(ConnectionError::TooManyConnections);
}

Expand Down

0 comments on commit a82a83f

Please sign in to comment.