Skip to content

Commit

Permalink
Revert "Update client.rs (#4)" (#5)
Browse files Browse the repository at this point in the history
This reverts commit 4647add.
  • Loading branch information
Max Lv authored Mar 17, 2022
1 parent 4647add commit 46e5d10
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,7 @@ async fn transfer(
let new_conn = endpoint
.connect(*remote, &host)?
.await
.map_err(|e| {
if e == ConnectionError::TimedOut {
let socket = if cfg!(target_os = "windows") {
std::net::UdpSocket::bind("0.0.0.0:0").unwrap()
} else {
std::net::UdpSocket::bind("[::]:0").unwrap()
};
let addr = socket.local_addr().unwrap();
let ret = endpoint.rebind(socket);
match ret {
Ok(_) => {
info!("rebinding to: {}", addr);
}
Err(e) => {
error!("rebind fail: {:?}", e);
}
}
}
anyhow!("failed to connect: {:?}", e)
}).unwrap();
.map_err(|e| anyhow!("failed to connect: {}", e))?;

let quinn::NewConnection {
connection: conn, ..
Expand Down

0 comments on commit 46e5d10

Please sign in to comment.