Skip to content

Commit

Permalink
links 0.2.10 on_disconnect patch
Browse files Browse the repository at this point in the history
  • Loading branch information
softstream-link committed Feb 13, 2024
1 parent 13a0083 commit e103447
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
1 change: 0 additions & 1 deletion .github/workflows/pull-master-stable.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Pull/Master Control Build
on:
pull_request:
push:
branches:
- release*
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/push-test-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Push Test Build
on:
pull_request:
branches:
- '*'
- '!release*'
- '!master'
push:
branches:
- '*'
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
18 changes: 11 additions & 7 deletions connect/core/src/core/protocol/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,17 @@ impl<RecvP: SoupBinTcpPayload<RecvP>, SendP: SoupBinTcpPayload<SendP>> 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<C: SendNonBlocking<<Self as Messenger>::SendT> + ReSendNonBlocking<<Self as Messenger>::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)]
Expand Down Expand Up @@ -281,13 +292,6 @@ impl<RecvP: SoupBinTcpPayload<RecvP>, SendP: SoupBinTcpPayload<SendP>> 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, <Self as Messenger>::SendT)> {
Some((self.io_timeout, EndOfSession::default().into()))
}
}
impl<RecvP: SoupBinTcpPayload<RecvP>, SendP: SoupBinTcpPayload<SendP>> Protocol for SvcSoupBinTcpProtocolAuto<RecvP, SendP> {
#[inline(always)]
Expand Down

0 comments on commit e103447

Please sign in to comment.