From e10344728ace6d17761413e5fb65833244e01483 Mon Sep 17 00:00:00 2001 From: softstream-link Date: Tue, 13 Feb 2024 16:45:23 -0500 Subject: [PATCH] links 0.2.10 on_disconnect patch --- .github/workflows/pull-master-stable.yml | 1 - .github/workflows/push-test-matrix.yml | 5 +++++ Cargo.toml | 2 +- connect/core/src/core/protocol/auto.rs | 18 +++++++++++------- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull-master-stable.yml b/.github/workflows/pull-master-stable.yml index 8b50dcf..e801947 100644 --- a/.github/workflows/pull-master-stable.yml +++ b/.github/workflows/pull-master-stable.yml @@ -1,6 +1,5 @@ name: Pull/Master Control Build on: - pull_request: push: branches: - release* diff --git a/.github/workflows/push-test-matrix.yml b/.github/workflows/push-test-matrix.yml index 6e6aa44..e338ac5 100644 --- a/.github/workflows/push-test-matrix.yml +++ b/.github/workflows/push-test-matrix.yml @@ -1,5 +1,10 @@ name: Push Test Build on: + pull_request: + branches: + - '*' + - '!release*' + - '!master' push: branches: - '*' diff --git a/Cargo.toml b/Cargo.toml index 2786363..18ce958 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ spin = { version = "0.9" } # spinlocks lazy_static = { version = "1.4.0" } # logging log = { version = "0.4" } -env_logger = { version = "0.10" } +env_logger = { version = "0.11" } colored = { version = "2.0" } # benches criterion = { version = "0.5" } diff --git a/connect/core/src/core/protocol/auto.rs b/connect/core/src/core/protocol/auto.rs index d7ef731..999ada3 100644 --- a/connect/core/src/core/protocol/auto.rs +++ b/connect/core/src/core/protocol/auto.rs @@ -254,6 +254,17 @@ impl, SendP: SoupBinTcpPayload> ProtocolC RecvStatus::WouldBlock => Err(Error::new(ErrorKind::TimedOut, format!("Did not get LoginRequest during timeout: {:?}", self.io_timeout))), } } + /// Returns a tuple of + /// * [Duration] - the timeout during which the [CltSender] will wait while delivering final message before disconnecting + /// * [EndOfSession] - the message to be sent to the client + #[inline(always)] + fn on_disconnect::SendT> + ReSendNonBlocking<::SendT> + ConnectionId>(&self, con: &mut C) -> Result<(), Error> { + let mut msg = EndOfSession::default().into(); + match con.send_busywait_timeout(&mut msg, self.io_timeout)? { + SendStatus::Completed => Ok(()), + SendStatus::WouldBlock => Err(Error::new(ErrorKind::TimedOut, format!("timeout: {:?} sending msg: {:?}", self.io_timeout, msg))), + } + } /// Will delegate to [`SvcSoupBinTcpRecvConnectionState::on_recv`] #[allow(unused_variables)] // when compiled in release mode `who` is not used #[inline(always)] @@ -281,13 +292,6 @@ impl, SendP: SoupBinTcpPayload> ProtocolC fn is_connected(&self) -> bool { (*self.recv_con_state.lock()).is_connected() && (*self.send_con_state.lock()).is_connected() } - /// Returns a tuple of - /// * [Duration] - the timeout during which the [CltSender] will wait while delivering final message before disconnecting - /// * [EndOfSession] - the message to be sent to the client - #[inline(always)] - fn on_disconnect(&self) -> Option<(Duration, ::SendT)> { - Some((self.io_timeout, EndOfSession::default().into())) - } } impl, SendP: SoupBinTcpPayload> Protocol for SvcSoupBinTcpProtocolAuto { #[inline(always)]