mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-03 21:07:39 +03:00
wip
This commit is contained in:
parent
24ed090574
commit
0d58e280c2
3 changed files with 9 additions and 8 deletions
|
@ -49,7 +49,7 @@ async fn connect_inner(
|
|||
|
||||
let (sender, rx) = channel();
|
||||
|
||||
crate::rt_impl::connect::ConnectOps::current().connect("-", fd, addr, sender)?;
|
||||
crate::rt_impl::connect::ConnectOps::current().connect(fd, addr, sender)?;
|
||||
|
||||
rx.await
|
||||
.map_err(|_| io::Error::new(io::ErrorKind::Other, "IO Driver is gone"))
|
||||
|
|
|
@ -22,7 +22,6 @@ struct ConnectOpsBatcher {
|
|||
|
||||
struct Item {
|
||||
fd: RawFd,
|
||||
tag: &'static str,
|
||||
sender: Sender<io::Result<()>>,
|
||||
}
|
||||
|
||||
|
@ -50,7 +49,6 @@ impl ConnectOps {
|
|||
|
||||
pub(crate) fn connect(
|
||||
&self,
|
||||
tag: &'static str,
|
||||
fd: RawFd,
|
||||
addr: SockAddr,
|
||||
sender: Sender<io::Result<()>>,
|
||||
|
@ -61,12 +59,12 @@ impl ConnectOps {
|
|||
res?;
|
||||
}
|
||||
|
||||
let item = Item { tag, fd, sender };
|
||||
let item = Item { fd, sender };
|
||||
let id = self.0.connects.borrow_mut().insert(item);
|
||||
|
||||
self.0
|
||||
.api
|
||||
.attach(tag, fd, id as u32, Some(Event::writable(0)));
|
||||
.attach("-", fd, id as u32, Some(Event::writable(0)));
|
||||
Ok(id)
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +95,7 @@ impl Handler for ConnectOpsBatcher {
|
|||
Err(io::Error::from_raw_os_error(err))
|
||||
};
|
||||
|
||||
self.inner.api.detach(item.tag, item.fd, id as u32);
|
||||
self.inner.api.detach("-", item.fd, id as u32);
|
||||
let _ = item.sender.send(res);
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +107,7 @@ impl Handler for ConnectOpsBatcher {
|
|||
if connects.contains(id) {
|
||||
let item = connects.remove(id);
|
||||
let _ = item.sender.send(Err(err));
|
||||
self.inner.api.detach(item.tag, item.fd, id as u32);
|
||||
self.inner.api.detach("-", item.fd, id as u32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -380,7 +380,10 @@ impl Accept {
|
|||
fn accept(&mut self, token: usize) -> bool {
|
||||
loop {
|
||||
if let Some(info) = self.sockets.get_mut(token) {
|
||||
match info.sock.accept() {
|
||||
let item = info.sock.accept();
|
||||
println!("------- ACCEPTING {:?}", item);
|
||||
//match info.sock.accept() {
|
||||
match item {
|
||||
Ok(Some(io)) => {
|
||||
let msg = Connection {
|
||||
io,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue