From 5d009c8c828a33808579ead0cb60a5dfe1f00884 Mon Sep 17 00:00:00 2001 From: Hadi Hosseini Date: Wed, 29 Aug 2018 01:42:06 +0430 Subject: [PATCH 1/7] add unicast method --- src/communication.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/communication.rs b/src/communication.rs index a6020c6..1ae53a5 100644 --- a/src/communication.rs +++ b/src/communication.rs @@ -132,6 +132,22 @@ impl Sender { .map_err(Error::from) } + /// Send a unicast message + /// + /// send message to specific connection_id and token + pub fn unicast(&self, msg: M, utoken :Token, ucid : u32 ) -> Result<()> where + M: Into, + { + self.channel + .send(Command { + token: utoken, + signal: Signal::Message(msg.into()), + connection_id: ucid, + }) + .map_err(Error::from) + } + + /// Send a close code to the other endpoint. #[inline] pub fn close(&self, code: CloseCode) -> Result<()> { From fef68f234e31cfe4eb449f22e11cf4bb285d8216 Mon Sep 17 00:00:00 2001 From: Hadi Hosseini Date: Wed, 5 Sep 2018 09:38:15 +0430 Subject: [PATCH 2/7] Update lib.rs --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index dca05e5..4c0160a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,7 +133,7 @@ pub struct Settings { /// connections because this is a hard limit and no new connections beyond /// this limit can be made until an old connection is dropped. /// Default: 100 - pub max_connections: usize, + pub max_connections: 1000000, /// The number of events anticipated per connection. The event loop queue size will /// be `queue_size` * `max_connections`. In order to avoid an overflow error, /// `queue_size` * `max_connections` must be less than or equal to `usize::max_value()`. @@ -141,7 +141,7 @@ pub struct Settings { /// more events than `queue_size` provided that another connection is using less than /// `queue_size`. However, if the queue is maxed out a Queue error will occur. /// Default: 5 - pub queue_size: usize, + pub queue_size: 1000000, /// Whether to panic when unable to establish a new TCP connection. /// Default: false pub panic_on_new_connection: bool, From 5e454901b35faff8cbdc39e0222ccd8200516735 Mon Sep 17 00:00:00 2001 From: Hadi Hosseini Date: Wed, 5 Sep 2018 10:11:18 +0430 Subject: [PATCH 3/7] Update lib.rs --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4c0160a..26bb148 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,7 +133,7 @@ pub struct Settings { /// connections because this is a hard limit and no new connections beyond /// this limit can be made until an old connection is dropped. /// Default: 100 - pub max_connections: 1000000, + pub max_connections: 1000, /// The number of events anticipated per connection. The event loop queue size will /// be `queue_size` * `max_connections`. In order to avoid an overflow error, /// `queue_size` * `max_connections` must be less than or equal to `usize::max_value()`. @@ -141,7 +141,7 @@ pub struct Settings { /// more events than `queue_size` provided that another connection is using less than /// `queue_size`. However, if the queue is maxed out a Queue error will occur. /// Default: 5 - pub queue_size: 1000000, + pub queue_size: usize, /// Whether to panic when unable to establish a new TCP connection. /// Default: false pub panic_on_new_connection: bool, From 1c4da4251f0e9f05a00a2f45566d9b6d3d2ecbfa Mon Sep 17 00:00:00 2001 From: Hadi Hosseini Date: Wed, 5 Sep 2018 10:42:42 +0430 Subject: [PATCH 4/7] Update lib.rs --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 26bb148..b368184 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,7 +133,7 @@ pub struct Settings { /// connections because this is a hard limit and no new connections beyond /// this limit can be made until an old connection is dropped. /// Default: 100 - pub max_connections: 1000, + pub max_connections: usize, /// The number of events anticipated per connection. The event loop queue size will /// be `queue_size` * `max_connections`. In order to avoid an overflow error, /// `queue_size` * `max_connections` must be less than or equal to `usize::max_value()`. @@ -238,8 +238,8 @@ pub struct Settings { impl Default for Settings { fn default() -> Settings { Settings { - max_connections: 100, - queue_size: 5, + max_connections: 1_000_000, + queue_size: 20, panic_on_new_connection: false, panic_on_shutdown: false, fragments_capacity: 10, From ad4509d4d7207e53e61357840def95a608897ee9 Mon Sep 17 00:00:00 2001 From: Hadi Hosseini Date: Sun, 9 Sep 2018 01:01:01 +0430 Subject: [PATCH 5/7] Update communication.rs edit variable name to be descriptive --- src/communication.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/communication.rs b/src/communication.rs index 1ae53a5..d14e0ee 100644 --- a/src/communication.rs +++ b/src/communication.rs @@ -135,14 +135,14 @@ impl Sender { /// Send a unicast message /// /// send message to specific connection_id and token - pub fn unicast(&self, msg: M, utoken :Token, ucid : u32 ) -> Result<()> where + pub fn unicast(&self, msg: M, peer_token :Token, peer_connection_id : u32 ) -> Result<()> where M: Into, { self.channel .send(Command { - token: utoken, + token: peer_token, signal: Signal::Message(msg.into()), - connection_id: ucid, + connection_id: peer_connection_id, }) .map_err(Error::from) } From a3fadecb08a28799825a27e5b04407fae582ff82 Mon Sep 17 00:00:00 2001 From: Hadi Hosseini Date: Sun, 9 Sep 2018 01:02:10 +0430 Subject: [PATCH 6/7] Update lib.rs revert debug value --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b368184..dca05e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -238,8 +238,8 @@ pub struct Settings { impl Default for Settings { fn default() -> Settings { Settings { - max_connections: 1_000_000, - queue_size: 20, + max_connections: 100, + queue_size: 5, panic_on_new_connection: false, panic_on_shutdown: false, fragments_capacity: 10, From f50248091b4fce7fa44bbcb39dee6574415c067b Mon Sep 17 00:00:00 2001 From: Hadi Hosseini Date: Sat, 16 Feb 2019 21:08:36 +0330 Subject: [PATCH 7/7] Update Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 395e0dd..74ea98b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ version = "0.9" [dependencies.native-tls] optional = true -version = "0.1.5" +version = "0.2.2" [dev-dependencies] clap = "2.31.2"