aboutsummaryrefslogtreecommitdiff
path: root/src/client.rs
diff options
context:
space:
mode:
authorHenauxg <19689618+Henauxg@users.noreply.github.com>2023-01-18 15:54:37 +0100
committerHenauxg <19689618+Henauxg@users.noreply.github.com>2023-01-18 15:54:37 +0100
commitbcaba7612398a31c8f9ca7d40bcfe66b0c25a62d (patch)
treec782e1e1bd45a46af04cb95d0c6825f0b41f0c3d /src/client.rs
parent5ed882d7e50265aa8f7d80aedeb2596f2bb1861b (diff)
[client] Use shared reception tasks
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/client.rs b/src/client.rs
index 51cc0ea..0efe051 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -148,9 +148,17 @@ impl Client {
connection.open_channel(ChannelType::UnorderedReliable)?;
connection.open_channel(ChannelType::Unreliable)?;
+ self.last_gen_id += 1;
+ let connection_id = self.last_gen_id;
+ self.connections.insert(connection_id, connection);
+ if self.default_connection_id.is_none() {
+ self.default_connection_id = Some(connection_id);
+ }
+
// Async connection
self.runtime.spawn(async move {
connection_task(
+ connection_id,
config,
cert_mode,
to_sync_client_send,
@@ -162,13 +170,6 @@ impl Client {
.await
});
- self.last_gen_id += 1;
- let connection_id = self.last_gen_id;
- self.connections.insert(connection_id, connection);
- if self.default_connection_id.is_none() {
- self.default_connection_id = Some(connection_id);
- }
-
Ok((connection_id, ordered_reliable_id))
}