feat(server): collect and postpone incoming PDUs during reactivation

The client may have pending messages while the activation-reactivation
sequence is ongoing. Let's collect them in this case and restore them
after successfull reconnection.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2024-08-14 20:17:57 +04:00 committed by Benoît Cortier
parent f8c0c0ed47
commit 09ae0d043d
2 changed files with 21 additions and 6 deletions

View file

@ -1,6 +1,7 @@
#[macro_use]
extern crate tracing;
use ironrdp_async::bytes::Bytes;
use ironrdp_async::{single_sequence_step, Framed, FramedRead, FramedWrite, StreamWrapper};
use ironrdp_connector::ConnectorResult;
use ironrdp_pdu::write_buf::WriteBuf;
@ -48,6 +49,7 @@ where
pub async fn accept_finalize<S>(
mut framed: Framed<S>,
acceptor: &mut Acceptor,
mut unmatched: Option<&mut Vec<Bytes>>,
) -> ConnectorResult<(Framed<S>, AcceptorResult)>
where
S: FramedRead + FramedWrite,
@ -58,7 +60,6 @@ where
if let Some(result) = acceptor.get_result() {
return Ok((framed, result));
}
single_sequence_step(&mut framed, acceptor, &mut buf, None).await?;
single_sequence_step(&mut framed, acceptor, &mut buf, unmatched.as_deref_mut()).await?;
}
}