mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
refactor(async): impl FramedWrite for Frame
This allows to specialize functions that want to simply write_all() with a Framed. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
committed by
Benoît Cortier
parent
3c6b2ef2e2
commit
fa10362106
@@ -209,10 +209,14 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> Framed<S>
|
||||
impl<S> FramedWrite for Framed<S>
|
||||
where
|
||||
S: FramedWrite,
|
||||
{
|
||||
type WriteAllFut<'write> = S::WriteAllFut<'write>
|
||||
where
|
||||
Self: 'write;
|
||||
|
||||
/// Attempts to write an entire buffer into this `Framed`’s stream.
|
||||
///
|
||||
/// # Cancel safety
|
||||
@@ -222,8 +226,8 @@ where
|
||||
/// branch completes first, then the provided buffer may have been
|
||||
/// partially written, but future calls to `write_all` will start over
|
||||
/// from the beginning of the buffer.
|
||||
pub async fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
|
||||
self.stream.write_all(buf).await
|
||||
fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteAllFut<'a> {
|
||||
self.stream.write_all(buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use ironrdp::session::{fast_path, ActiveStage, ActiveStageOutput, GracefulDiscon
|
||||
use ironrdp::{cliprdr, connector, rdpdr, rdpsnd, session};
|
||||
use ironrdp_core::WriteBuf;
|
||||
use ironrdp_rdpsnd_native::cpal;
|
||||
use ironrdp_tokio::{single_sequence_step_read, split_tokio_framed};
|
||||
use ironrdp_tokio::{single_sequence_step_read, split_tokio_framed, FramedWrite};
|
||||
use rdpdr::NoopRdpdrBackend;
|
||||
use smallvec::SmallVec;
|
||||
use tokio::net::TcpStream;
|
||||
|
||||
@@ -27,7 +27,7 @@ use ironrdp::pdu::rdp::client_info::PerformanceFlags;
|
||||
use ironrdp::session::image::DecodedImage;
|
||||
use ironrdp::session::{fast_path, ActiveStage, ActiveStageOutput, GracefulDisconnectReason};
|
||||
use ironrdp_core::WriteBuf;
|
||||
use ironrdp_futures::single_sequence_step_read;
|
||||
use ironrdp_futures::{single_sequence_step_read, FramedWrite};
|
||||
use rgb::AsPixels as _;
|
||||
use tap::prelude::*;
|
||||
use wasm_bindgen::prelude::*;
|
||||
@@ -958,7 +958,7 @@ async fn connect_rdcleanpath<S>(
|
||||
pcb: Option<String>,
|
||||
) -> Result<(ironrdp_futures::Upgraded, Vec<u8>), IronRdpError>
|
||||
where
|
||||
S: ironrdp_futures::FramedRead + ironrdp_futures::FramedWrite,
|
||||
S: ironrdp_futures::FramedRead + FramedWrite,
|
||||
{
|
||||
use ironrdp::connector::Sequence as _;
|
||||
use x509_cert::der::Decode as _;
|
||||
|
||||
Reference in New Issue
Block a user