This commit is contained in:
Ferdinand Schober
2024-07-09 20:16:48 +02:00
parent cb6ad7f1ac
commit 289c21e000
4 changed files with 7 additions and 8 deletions

View File

@@ -1,4 +1,3 @@
use reis::tokio::EiConvertEventStreamError;
use thiserror::Error;
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
@@ -11,7 +10,7 @@ use wayland_client::{
};
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
use reis::tokio::HandshakeError;
use reis::tokio::{EiConvertEventStreamError, HandshakeError};
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
#[derive(Debug, Error)]
@@ -35,10 +34,13 @@ pub enum CaptureError {
EndOfStream,
#[error("io error: `{0}`")]
Io(#[from] std::io::Error),
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
#[error("error in libei stream: `{0}`")]
Reis(#[from] ReisConvertEventStreamError),
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
#[error("libei handshake failed: `{0}`")]
Handshake(#[from] HandshakeError),
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
#[error(transparent)]
Portal(#[from] ashpd::Error),
}
@@ -60,7 +62,7 @@ pub enum CaptureCreationError {
#[error("error creating macos capture backend: `{0}`")]
Macos(#[from] MacOSInputCaptureCreationError),
#[cfg(windows)]
#[error("error creating windows capture backend: `{0}`")]
#[error("error creating windows capture backend")]
Windows,
}

View File

@@ -1,4 +1,3 @@
use anyhow::Result;
use core::task::{Context, Poll};
use futures::Stream;
use once_cell::unsync::Lazy;

View File

@@ -1,4 +1,3 @@
use anyhow::Result;
use ashpd::{
desktop::{
remote_desktop::{Axis, DeviceType, KeyState, RemoteDesktop},

View File

@@ -1,6 +1,5 @@
use std::{io, net::SocketAddr};
use anyhow::Result;
use thiserror::Error;
use tokio::{
net::UdpSocket,
@@ -16,7 +15,7 @@ use super::Server;
pub async fn new(
server: Server,
frontend_notify_tx: Sender<FrontendEvent>,
) -> Result<(
) -> io::Result<(
JoinHandle<()>,
Sender<(Event, SocketAddr)>,
Receiver<Result<(Event, SocketAddr), NetworkError>>,
@@ -113,7 +112,7 @@ async fn receive_event(socket: &UdpSocket) -> Result<(Event, SocketAddr), Networ
Ok((Event::try_from(buf)?, src))
}
fn send_event(sock: &UdpSocket, e: Event, addr: SocketAddr) -> Result<usize> {
fn send_event(sock: &UdpSocket, e: Event, addr: SocketAddr) -> Result<usize, NetworkError> {
log::trace!("{:20} ------>->->-> {addr}", e.to_string());
let data: Vec<u8> = (&e).into();
// When udp blocks, we dont want to block the event loop.