X-Git-Url: https://code.octet-stream.net/netwatcher/blobdiff_plain/473c9605820f4531f9d40823338fa4bf8718dd6f..a26e228658fabc4495f3d671850903c8e105d9a1:/src/watch_linux.rs?ds=inline diff --git a/src/watch_linux.rs b/src/watch_linux.rs index e8e1ffc..c38be37 100644 --- a/src/watch_linux.rs +++ b/src/watch_linux.rs @@ -44,14 +44,14 @@ fn start_watcher_thread( SockFlag::empty(), Some(SockProtocol::NetlinkRoute), ) - .map_err(|e| Error::CreateSocket(e))?; - // TODO: set nonblocking + .map_err(|e| Error::CreateSocket(e.to_string()))?; + sockfd.set_nonblocking(true); let sa_nl = NetlinkAddr::new( 0, (RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR) as u32, ); - bind(sockfd.as_raw_fd(), &sa_nl).map_err(|e| Error::Bind(e))?; - let (pipe_rd, pipe_wr) = pipe().map_err(|e| Error::CreatePipe(e))?; + bind(sockfd.as_raw_fd(), &sa_nl).map_err(|e| Error::Bind(e.to_string()))?; + let (pipe_rd, pipe_wr) = pipe().map_err(|e| Error::CreatePipe(e.to_string()))?; let mut prev_list = List::default(); let mut handle_update = move |new_list: List| {