mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-04 13:27:39 +03:00
wip
This commit is contained in:
parent
ff028c393b
commit
05510c7b88
1 changed files with 49 additions and 39 deletions
|
@ -132,7 +132,7 @@ impl<T> Handler for StreamOpsHandler<T> {
|
|||
for (id, change) in self.feed.drain(..) {
|
||||
match change {
|
||||
Change::Readable => {
|
||||
let item = &mut streams[id];
|
||||
if let Some(item) = streams.get_mut(id) {
|
||||
let result = item.context.with_read_buf(|buf| {
|
||||
let chunk = buf.chunk_mut();
|
||||
let b = chunk.as_mut_ptr();
|
||||
|
@ -147,7 +147,7 @@ impl<T> Handler for StreamOpsHandler<T> {
|
|||
item.context.tag(),
|
||||
item.fd,
|
||||
size,
|
||||
buf
|
||||
buf,
|
||||
);
|
||||
}),
|
||||
)
|
||||
|
@ -160,12 +160,17 @@ impl<T> Handler for StreamOpsHandler<T> {
|
|||
item.flags.remove(Flags::RD);
|
||||
}
|
||||
}
|
||||
}
|
||||
Change::Writable => {
|
||||
let item = &mut streams[id];
|
||||
if let Some(item) = streams.get_mut(id) {
|
||||
let result = item.context.with_write_buf(|buf| {
|
||||
let slice = &buf[..];
|
||||
syscall!(
|
||||
break libc::write(item.fd, slice.as_ptr() as _, slice.len())
|
||||
break libc::write(
|
||||
item.fd,
|
||||
slice.as_ptr() as _,
|
||||
slice.len()
|
||||
)
|
||||
)
|
||||
});
|
||||
|
||||
|
@ -176,6 +181,7 @@ impl<T> Handler for StreamOpsHandler<T> {
|
|||
item.flags.remove(Flags::WR);
|
||||
}
|
||||
}
|
||||
}
|
||||
Change::Error(err) => {
|
||||
if let Some(item) = streams.get_mut(id) {
|
||||
item.context.stopped(Some(err));
|
||||
|
@ -203,9 +209,11 @@ impl<T> Handler for StreamOpsHandler<T> {
|
|||
item.fd,
|
||||
item.io.is_some()
|
||||
);
|
||||
if item.io.is_some() {
|
||||
self.inner.api.unregister_all(item.fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.inner.feed.set(Some(feed));
|
||||
self.inner.streams.set(Some(streams));
|
||||
|
@ -363,8 +371,10 @@ impl<T> Drop for StreamCtl<T> {
|
|||
item.fd,
|
||||
item.io.is_some()
|
||||
);
|
||||
if item.io.is_some() {
|
||||
self.inner.api.unregister_all(item.fd);
|
||||
}
|
||||
}
|
||||
self.inner.streams.set(Some(streams));
|
||||
} else {
|
||||
let mut feed = self.inner.feed.take().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue