mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-24 09:06:10 +03:00
Merge pull request #69 from uqbar-dao/dr/net-timeout-when-recv
fix: make connection receiver always time out
This commit is contained in:
commit
863cb78741
@ -387,23 +387,30 @@ async fn direct_networking(
|
||||
if let Ok(websocket) = accept_async(MaybeTlsStream::Plain(stream)).await {
|
||||
print_debug(&print_tx, "net: received new websocket connection").await;
|
||||
let (peer_id, routing_for, conn) =
|
||||
match recv_connection(
|
||||
match time::timeout(TIMEOUT, recv_connection(
|
||||
&our,
|
||||
&our_ip,
|
||||
&pki,
|
||||
&peers,
|
||||
&mut pending_passthroughs,
|
||||
&keypair,
|
||||
websocket).await
|
||||
websocket)).await
|
||||
{
|
||||
Ok(res) => res,
|
||||
Err(e) => {
|
||||
Ok(Ok(res)) => res,
|
||||
Ok(Err(e)) => {
|
||||
print_tx.send(Printout {
|
||||
verbosity: 0,
|
||||
content: format!("net: recv_connection failed: {e}"),
|
||||
}).await?;
|
||||
continue;
|
||||
}
|
||||
Err(e) => {
|
||||
print_tx.send(Printout {
|
||||
verbosity: 0,
|
||||
content: "net: recv_connection timed out".into(),
|
||||
}).await?;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
// TODO if their handshake indicates they want us to proxy
|
||||
// for them (aka act as a router for them) we can choose
|
||||
|
Loading…
Reference in New Issue
Block a user