From 944fd4f5d296f9f76eb84e08049739cd5c8691f0 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 30 Oct 2019 14:25:21 +0100 Subject: [PATCH] set PolledFd to nonblocking Signed-off-by: Wolfgang Bumiller --- src/reactor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/reactor.rs b/src/reactor.rs index c5d5110..478c0cb 100644 --- a/src/reactor.rs +++ b/src/reactor.rs @@ -6,6 +6,7 @@ use std::task::{Context, Poll, Waker}; use std::thread::JoinHandle; use crate::epoll::{Epoll, EpollEvent, EPOLLERR, EPOLLET, EPOLLHUP, EPOLLIN, EPOLLOUT}; +use crate::error::io_err_other; use crate::tools::Fd; static START: Once = Once::new(); @@ -160,6 +161,7 @@ impl AsRawFd for PolledFd { impl PolledFd { pub fn new(fd: Fd) -> io::Result { + fd.set_nonblocking(true).map_err(io_err_other)?; Self::new_with_reactor(fd, crate::reactor::default()) }