From c2c5e3c299d1f3f9a2074636d51fd3ebbdb1a453 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 1 Jan 2022 13:38:39 -0500 Subject: [PATCH] network fixes, still a lot more to do for tcp --- scripts/run_2.sh | 2 +- scripts/run_20.sh | 2 +- scripts/run_4.sh | 2 +- scripts/run_8.sh | 2 +- veilid-core/src/intf/native/network/protocol/mod.rs | 10 ++++++---- veilid-core/src/intf/native/network/protocol/tcp.rs | 13 +++++++++---- veilid-core/src/intf/native/network/protocol/ws.rs | 2 +- veilid-core/src/network_manager.rs | 6 +++--- veilid-core/src/rpc_processor/mod.rs | 7 +++++-- veilid-core/src/xx/bump_port.rs | 4 ++-- 10 files changed, 30 insertions(+), 20 deletions(-) diff --git a/scripts/run_2.sh b/scripts/run_2.sh index 7000b345..1f786376 100755 --- a/scripts/run_2.sh +++ b/scripts/run_2.sh @@ -1,4 +1,4 @@ #!/bin/bash -exec ./run_local_test.py 2 --config-file ./local-test.yml $1 +exec ./run_local_test.py 2 --config-file ./local-test.yml $@ diff --git a/scripts/run_20.sh b/scripts/run_20.sh index 195d9cfb..21022a7d 100755 --- a/scripts/run_20.sh +++ b/scripts/run_20.sh @@ -1,4 +1,4 @@ #!/bin/bash -exec ./run_local_test.py 20 --config-file ./local-test.yml $1 +exec ./run_local_test.py 20 --config-file ./local-test.yml $@ diff --git a/scripts/run_4.sh b/scripts/run_4.sh index dc008976..d29e7a0f 100755 --- a/scripts/run_4.sh +++ b/scripts/run_4.sh @@ -1,4 +1,4 @@ #!/bin/bash -exec ./run_local_test.py 4 --config-file ./local-test.yml $1 +exec ./run_local_test.py 4 --config-file ./local-test.yml $@ diff --git a/scripts/run_8.sh b/scripts/run_8.sh index 411472ef..863f97f2 100755 --- a/scripts/run_8.sh +++ b/scripts/run_8.sh @@ -1,4 +1,4 @@ #!/bin/bash -exec ./run_local_test.py 8 --config-file ./local-test.yml $1 +exec ./run_local_test.py 8 --config-file ./local-test.yml $@ diff --git a/veilid-core/src/intf/native/network/protocol/mod.rs b/veilid-core/src/intf/native/network/protocol/mod.rs index 6cc18d1c..538e1b5f 100644 --- a/veilid-core/src/intf/native/network/protocol/mod.rs +++ b/veilid-core/src/intf/native/network/protocol/mod.rs @@ -81,7 +81,7 @@ pub fn new_shared_tcp_socket(local_address: SocketAddr) -> Result Result>( &self, - dial_info: DialInfo, + dial_info: &DialInfo, rcpt_data: B, alternate_port: bool, ) -> Result<(), String> { @@ -553,11 +553,11 @@ impl NetworkManager { // Send receipt directly if alternate_port { self.net() - .send_data_unbound_to_dial_info(&dial_info, rcpt_data.as_ref().to_vec()) + .send_data_unbound_to_dial_info(dial_info, rcpt_data.as_ref().to_vec()) .await } else { self.net() - .send_data_to_dial_info(&dial_info, rcpt_data.as_ref().to_vec()) + .send_data_to_dial_info(dial_info, rcpt_data.as_ref().to_vec()) .await } } diff --git a/veilid-core/src/rpc_processor/mod.rs b/veilid-core/src/rpc_processor/mod.rs index 64b9a139..452a4a5c 100644 --- a/veilid-core/src/rpc_processor/mod.rs +++ b/veilid-core/src/rpc_processor/mod.rs @@ -945,9 +945,12 @@ impl RPCProcessor { // Possibly from an alternate port let network_manager = self.network_manager(); network_manager - .send_direct_receipt(dial_info, rcpt_data, alternate_port) + .send_direct_receipt(&dial_info, rcpt_data, alternate_port) .await - .map_err(map_error_string!())?; + .map_err(map_error_string!()) + .map_err( + logthru_net!(error "failed to send direct receipt to dial info: {}, alternate_port={}", dial_info, alternate_port), + )?; Ok(()) } diff --git a/veilid-core/src/xx/bump_port.rs b/veilid-core/src/xx/bump_port.rs index c2758bcc..60619928 100644 --- a/veilid-core/src/xx/bump_port.rs +++ b/veilid-core/src/xx/bump_port.rs @@ -15,7 +15,7 @@ pub enum BumpPortType { pub fn tcp_port_available(addr: &SocketAddr) -> bool { cfg_if! { if #[cfg(target_arch = "wasm32")] { - false + true } else { match TcpListener::bind(addr) { Ok(_) => true, @@ -28,7 +28,7 @@ pub fn tcp_port_available(addr: &SocketAddr) -> bool { pub fn udp_port_available(addr: &SocketAddr) -> bool { cfg_if! { if #[cfg(target_arch = "wasm32")] { - false + true } else { match UdpSocket::bind(addr) { Ok(_) => true,