Skip to content

Commit

Permalink
horrible 2, horrible 1 didn't break, just not run
Browse files Browse the repository at this point in the history
  • Loading branch information
mariari committed Nov 3, 2023
1 parent 871a4a0 commit 4dfe215
Showing 1 changed file with 38 additions and 33 deletions.
71 changes: 38 additions & 33 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,41 +173,46 @@ where
info: self.info.clone(),
snapshot: self.snapshot.clone(),
};
match listener.accept().await {
Ok((socket, addr)) => {
// set parent: None for the connection span, as it should
// exist independently of the listener's spans.
let span = tracing::span!(parent: None, Level::ERROR, "abci", ?addr);
let conn = Connection {
consensus: self.consensus.clone(),
mempool: self.mempool.clone(),
info: self.info.clone(),
snapshot: self.snapshot.clone(),
};
tokio::spawn(async move {
backoff::future::retry::<_, BoxError, _, _, _>(
ExponentialBackoff::default(),
|| async {
match listener_clone.accept().await {
Ok((socket, _addr)) => {
if let Err(e) = conn.clone().run(socket).await {
Err(backoff::Error::Permanent(e))
} else {
Ok(())
}
}
Err(e) => {
Ok(())
}
tokio::spawn(async move {
backoff::future::retry::<_, BoxError, _, _, _>(
ExponentialBackoff::default(),
|| async {

match listener_clone.accept().await {
Ok((socket, addr)) => {

Check warning on line 182 in src/server.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `addr`
if let Err(e) = conn.clone().run(socket).await {
Err(backoff::Error::Permanent(e))
} else {
Ok(())
}
}
).await
}.instrument(span));
}
Err(e) => {
tracing::warn!({ %e }, "error accepting new tcp connection");
}
}
Err(e) => {
tracing::warn!({ %e }, "error accepting new tcp connection");
Ok(())
}
}
}
).await
});
//.instrument(span));

// match listener.accept().await {
//
// Ok((socket, addr)) => {
// // set parent: None for the connection span, as it should
// // exist independently of the listener's spans.
// let span = tracing::span!(parent: None, Level::ERROR, "abci", ?addr);
// let conn = Connection {
// consensus: self.consensus.clone(),
// mempool: self.mempool.clone(),
// info: self.info.clone(),
// snapshot: self.snapshot.clone(),
// };
// }
// Err(e) => {
// tracing::warn!({ %e }, "error accepting new tcp connection");
// }
// }

// tokio::spawn(async move {
// backoff::future::retry::<_, BoxError, _, _, _>(
Expand Down

0 comments on commit 4dfe215

Please sign in to comment.