Hack epoll_ctl to ignore non-socket fds

This commit is contained in:
He Sun 2019-11-13 09:37:01 +00:00 committed by Tate, Hongliang Tian
parent 5fa91becfa
commit 7e311ed6de

@ -186,7 +186,14 @@ pub fn do_epoll_ctl(
let mut file_ref = file_table_ref.get(epfd)?;
let mut epoll = file_ref.as_epoll()?.inner.lock().unwrap();
let host_fd = file_table_ref.get(fd)?.as_socket()?.fd() as FileDesc;
let fd_ref = file_table_ref.get(fd)?;
let sock_result = fd_ref.as_socket();
if sock_result.is_err() {
//FIXME: workaround for grpc, other fd types including pipe should be supported
return Ok(());
}
let host_fd = sock_result.unwrap().fd() as FileDesc;
epoll.ctl(op, host_fd, event)?;
Ok(())