1
0
Fork 0
forked from wry/wry

io-uring: add readable/writable

This commit is contained in:
Julian Orth 2022-05-12 20:33:58 +02:00
parent 25d817b722
commit dcdd91c0b0
31 changed files with 285 additions and 189 deletions

View file

@ -1,6 +1,6 @@
use {
crate::{
async_engine::{AsyncFd, SpawnedFuture},
async_engine::SpawnedFuture,
client::{Client, ClientId, EventFormatter},
it::{
test_error::{StdError, TestError},
@ -28,11 +28,12 @@ use {
rc::Rc,
task::Poll,
},
uapi::OwnedFd,
};
pub struct TestTransport {
pub run: Rc<TestRun>,
pub fd: AsyncFd,
pub socket: Rc<OwnedFd>,
pub client_id: Cell<ClientId>,
pub bufs: Stack<Vec<u32>>,
pub swapchain: Rc<RefCell<OutBufferSwapchain>>,
@ -132,7 +133,7 @@ impl TestTransport {
self.run.state.eng.spawn(
Incoming {
tc: self.clone(),
buf: BufFdIn::new(self.fd.clone()),
buf: BufFdIn::new(&self.socket, &self.run.state.ring),
}
.run(),
),
@ -141,7 +142,7 @@ impl TestTransport {
self.run.state.eng.spawn(
Outgoing {
tc: self.clone(),
buf: BufFdOut::new(self.fd.clone(), &self.run.state.wheel),
buf: BufFdOut::new(&self.socket, &self.run.state.ring, &self.run.state.wheel),
buffers: Default::default(),
}
.run(),

View file

@ -51,17 +51,12 @@ impl TestRun {
uapi::connect(socket.raw(), &self.server_addr)
.to_os_error()
.with_context(|| "Could not connect to the compositor")?;
let fd = self
.state
.eng
.fd(&socket)
.with_context(|| "Could not create an async fd")?;
let mut obj_ids = Bitfield::default();
obj_ids.take(0);
obj_ids.take(1);
let tran = Rc::new(TestTransport {
run: self.clone(),
fd,
socket,
client_id: Cell::new(ClientId::from_raw(0)),
bufs: Default::default(),
swapchain: Default::default(),