Skip to content

Commit

Permalink
fud v2
Browse files Browse the repository at this point in the history
  • Loading branch information
mariari committed Nov 2, 2023
1 parent 4a526c9 commit 87e951a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,15 @@ where

let server = self.clone();
let listener_clone = listener.clone();

tokio::spawn(async move {
let s = server.clone();

backoff::future::retry::<_, BoxError, _, _, _>(
ExponentialBackoff::default(),
|| async {
match listener_clone.accept().await {
Ok((socket, _addr)) => {
let s = server.clone();
let conn = Connection {
consensus: s.consensus.clone(),
mempool: s.mempool.clone(),
Expand All @@ -183,6 +185,7 @@ where
};

if let Err(e) = conn.run(socket).await {
drop(s);
match e.downcast::<tower::load_shed::error::Overloaded>() {
Err(e) => {
tracing::error!({ %e }, "error in a connection handler");
Expand Down

0 comments on commit 87e951a

Please sign in to comment.