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

View File

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

View File

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

View File

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