diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 4ef57f0e..cd3ecd0e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.3 +current_version = 0.1.4 [bumpversion:file:veilid-server/Cargo.toml] search = name = "veilid-server" diff --git a/Cargo.lock b/Cargo.lock index 0c7507a5..bd74a9d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4380,9 +4380,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.171" +version = "1.0.173" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f" dependencies = [ "serde_derive", ] @@ -4408,9 +4408,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.173" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49" dependencies = [ "proc-macro2", "quote", @@ -5627,7 +5627,7 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "veilid-cli" -version = "0.1.3" +version = "0.1.4" dependencies = [ "arboard", "async-std", @@ -5663,7 +5663,7 @@ dependencies = [ [[package]] name = "veilid-core" -version = "0.1.3" +version = "0.1.4" dependencies = [ "argon2", "async-io", @@ -5766,7 +5766,7 @@ dependencies = [ [[package]] name = "veilid-flutter" -version = "0.1.3" +version = "0.1.4" dependencies = [ "allo-isolate", "async-std", @@ -5795,7 +5795,7 @@ dependencies = [ [[package]] name = "veilid-server" -version = "0.1.3" +version = "0.1.4" dependencies = [ "ansi_term", "async-std", @@ -5845,7 +5845,7 @@ dependencies = [ [[package]] name = "veilid-tools" -version = "0.1.3" +version = "0.1.4" dependencies = [ "android-logd-logger", "async-lock", @@ -5896,7 +5896,7 @@ dependencies = [ [[package]] name = "veilid-wasm" -version = "0.1.3" +version = "0.1.4" dependencies = [ "cfg-if 1.0.0", "console_error_panic_hook", @@ -6515,9 +6515,9 @@ checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" [[package]] name = "xml-rs" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a56c84a8ccd4258aed21c92f70c0f6dea75356b6892ae27c24139da456f9336" +checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" [[package]] name = "xmltree" diff --git a/veilid-cli/Cargo.toml b/veilid-cli/Cargo.toml index 9be6a832..0c29379f 100644 --- a/veilid-cli/Cargo.toml +++ b/veilid-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-cli" -version = "0.1.3" +version = "0.1.4" authors = ["Veilid Team "] edition = "2021" license = "MPL-2.0" diff --git a/veilid-core/Cargo.toml b/veilid-core/Cargo.toml index 5cccb0d8..da56f53d 100644 --- a/veilid-core/Cargo.toml +++ b/veilid-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-core" -version = "0.1.3" +version = "0.1.4" authors = ["Veilid Team "] edition = "2021" build = "build.rs" diff --git a/veilid-core/src/network_manager/mod.rs b/veilid-core/src/network_manager/mod.rs index 6578fb1a..3f57f82f 100644 --- a/veilid-core/src/network_manager/mod.rs +++ b/veilid-core/src/network_manager/mod.rs @@ -1046,11 +1046,17 @@ impl NetworkManager { }; if let Some(relay_nr) = some_relay_nr { - // Ensure the protocol is forwarded exactly as is + // Ensure the protocol used to forward is of the same sequencing requirement // Address type is allowed to change if connectivity is better - let relay_nr = relay_nr.filtered_clone( - NodeRefFilter::new().with_protocol_type(connection_descriptor.protocol_type()), - ); + let relay_nr = if connection_descriptor.protocol_type().is_ordered() { + // XXX: this is a little redundant + let (_, nrf) = NodeRefFilter::new().with_sequencing(Sequencing::EnsureOrdered); + let mut relay_nr = relay_nr.filtered_clone(nrf); + relay_nr.set_sequencing(Sequencing::EnsureOrdered); + relay_nr + } else { + relay_nr + }; // Relay the packet to the desired destination log_net!("relaying {} bytes to {}", data.len(), relay_nr); diff --git a/veilid-core/src/network_manager/send_data.rs b/veilid-core/src/network_manager/send_data.rs index 8b07da43..70d9ce90 100644 --- a/veilid-core/src/network_manager/send_data.rs +++ b/veilid-core/src/network_manager/send_data.rs @@ -103,7 +103,7 @@ impl NetworkManager { target_node_ref: NodeRef, data: Vec, ) -> EyreResult> { - // First try to send data to the last socket we've seen this peer on + // First try to send data to the last connection we've seen this peer on let Some(connection_descriptor) = target_node_ref.last_connection() else { return Ok(NetworkResult::no_connection_other( format!("should have found an existing connection: {}", target_node_ref) @@ -149,7 +149,7 @@ impl NetworkManager { .is_some() { return Ok(NetworkResult::no_connection_other( - format!("failed to send to existing connection: {:?}", connection_descriptor) + format!("failed to send to unreachable node over existing connection: {:?}", connection_descriptor) )); } diff --git a/veilid-core/src/routing_table/tasks/ping_validator.rs b/veilid-core/src/routing_table/tasks/ping_validator.rs index 7f47fbc0..6f70b86b 100644 --- a/veilid-core/src/routing_table/tasks/ping_validator.rs +++ b/veilid-core/src/routing_table/tasks/ping_validator.rs @@ -43,12 +43,24 @@ impl RoutingTable { .set_relay_node_keepalive(Some(cur_ts)) .commit(); + // We need to keep-alive at one connection per ordering for relays + // but also one per NAT mapping that we need to keep open for our inbound dial info + let mut got_unordered = false; + let mut got_ordered = false; + // Look up any NAT mappings we may need to try to preserve with keepalives let mut mapped_port_info = self.get_low_level_port_info(); // Relay nodes get pinged over all protocols we have inbound dialinfo for // This is so we can preserve the inbound NAT mappings at our router + let mut relay_noderefs = vec![]; for did in &dids { + // Can skip the ones that are direct, those are not mapped or natted + // because we can have both direct and natted dialinfo on the same + // node, for example ipv4 can be natted, while ipv6 is direct + if did.class == DialInfoClass::Direct { + continue; + } // Do we need to do this ping? // Check if we have already pinged over this low-level-protocol/address-type/port combo // We want to ensure we do the bare minimum required here @@ -62,16 +74,35 @@ impl RoutingTable { } else { false }; - if !needs_ping_for_protocol { - continue; + if needs_ping_for_protocol { + if pt.is_ordered() { + got_ordered = true; + } else { + got_unordered = true; + } + let dif = did.dial_info.make_filter(); + let relay_nr_filtered = + relay_nr.filtered_clone(NodeRefFilter::new().with_dial_info_filter(dif)); + relay_noderefs.push(relay_nr_filtered); } + } + // Add noderef filters for ordered or unordered sequencing if we havent already seen those + if !got_ordered { + let (_, nrf) = NodeRefFilter::new().with_sequencing(Sequencing::EnsureOrdered); + let mut relay_nr_filtered = relay_nr.filtered_clone(nrf); + relay_nr_filtered.set_sequencing(Sequencing::EnsureOrdered); + relay_noderefs.push(relay_nr_filtered); + } + if !got_unordered { + relay_noderefs.push(relay_nr); + } + for relay_nr_filtered in relay_noderefs { let rpc = rpc.clone(); - let dif = did.dial_info.make_filter(); - let relay_nr_filtered = - relay_nr.filtered_clone(NodeRefFilter::new().with_dial_info_filter(dif)); - //#[cfg(feature = "network-result-extra")] + #[cfg(feature = "network-result-extra")] + log_rtab!(debug "--> Keepalive ping to {:?}", relay_nr_filtered); + #[cfg(not(feature = "network-result-extra"))] log_rtab!("--> Keepalive ping to {:?}", relay_nr_filtered); unord.push( diff --git a/veilid-flutter/pubspec.yaml b/veilid-flutter/pubspec.yaml index fe769b4d..4a87bff8 100644 --- a/veilid-flutter/pubspec.yaml +++ b/veilid-flutter/pubspec.yaml @@ -1,5 +1,5 @@ name: veilid -version: 0.1.3 +version: 0.1.4 description: Veilid Framework homepage: https://veilid.com publish_to: "none" # Remove this line if you wish to publish to pub.dev diff --git a/veilid-flutter/rust/Cargo.toml b/veilid-flutter/rust/Cargo.toml index aa76d8f6..cb0ab5b7 100644 --- a/veilid-flutter/rust/Cargo.toml +++ b/veilid-flutter/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-flutter" -version = "0.1.3" +version = "0.1.4" authors = ["Veilid Team "] license = "MPL-2.0" edition = "2021" diff --git a/veilid-python/pyproject.toml b/veilid-python/pyproject.toml index 35b13da1..7cb1c1f8 100644 --- a/veilid-python/pyproject.toml +++ b/veilid-python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "veilid" -version = "0.1.3" +version = "0.1.4" description = "" authors = ["Veilid Team "] readme = "README.md" diff --git a/veilid-server/Cargo.toml b/veilid-server/Cargo.toml index bfb88879..295d41ce 100644 --- a/veilid-server/Cargo.toml +++ b/veilid-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-server" -version = "0.1.3" +version = "0.1.4" authors = ["Veilid Team "] license = "MPL-2.0" edition = "2021" diff --git a/veilid-tools/Cargo.toml b/veilid-tools/Cargo.toml index c1b2be46..09869c52 100644 --- a/veilid-tools/Cargo.toml +++ b/veilid-tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-tools" -version = "0.1.3" +version = "0.1.4" authors = ["Veilid Team "] license = "MPL-2.0" edition = "2021" diff --git a/veilid-wasm/Cargo.toml b/veilid-wasm/Cargo.toml index 520a867c..f6f18ee0 100644 --- a/veilid-wasm/Cargo.toml +++ b/veilid-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "veilid-wasm" -version = "0.1.3" +version = "0.1.4" authors = ["Veilid Team "] license = "MPL-2.0" edition = "2021"