Skip to content

Commit

Permalink
Remove unused AtomicUsize and add error logging to TcpDialer connecti…
Browse files Browse the repository at this point in the history
…on attempts
  • Loading branch information
nullchinchilla committed Sep 19, 2024
1 parent 0228b1a commit 3047f02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 1 addition & 8 deletions libraries/picomux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
ops::Deref,
pin::Pin,
sync::{
atomic::{AtomicU64, AtomicUsize, Ordering},
atomic::{AtomicU64, Ordering},
Arc,
},
task::Poll,
Expand Down Expand Up @@ -237,16 +237,9 @@ async fn picomux_inner(
let send_more = SharedSemaphore::new(false, INIT_WINDOW);
// jelly bean movers
smolscale::spawn::<anyhow::Result<()>>({
static COUNT: AtomicUsize = AtomicUsize::new(0);

let send_outgoing = send_outgoing.clone();

async move {
// let count = COUNT.fetch_add(1, Ordering::Relaxed);
// eprintln!("opened {count} picomux streams");
// scopeguard::defer!({
// COUNT.fetch_sub(1, Ordering::Relaxed);
// });
let mut remote_window = INIT_WINDOW;
let mut target_remote_window = MAX_WINDOW;
let mut last_window_adjust = Instant::now();
Expand Down
7 changes: 5 additions & 2 deletions libraries/sillad/src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ pub struct TcpDialer {
impl Dialer for TcpDialer {
type P = TcpPipe;
async fn dial(&self) -> std::io::Result<Self::P> {
let inner = Async::<TcpStream>::connect(self.dest_addr).await?;
set_tcp_options(&inner)?;
let inner = Async::<TcpStream>::connect(self.dest_addr)
.await
.inspect_err(|e| tracing::warn!("inner dial failed: {:?}", e))?;
let _ =
set_tcp_options(&inner).inspect_err(|e| tracing::warn!("tcp option set fail: {:?}", e));
Ok(TcpPipe(inner, self.dest_addr.to_string()))
}
}
Expand Down

0 comments on commit 3047f02

Please sign in to comment.