Resolve #4334
This commit is contained in:
parent
5e8646583d
commit
efb4d97467
1 changed files with 6 additions and 5 deletions
|
|
@ -132,11 +132,12 @@ elif defined(linux):
|
||||||
s.fds[fd].events = events
|
s.fds[fd].events = events
|
||||||
|
|
||||||
proc unregister*(s: var Selector, fd: SocketHandle) =
|
proc unregister*(s: var Selector, fd: SocketHandle) =
|
||||||
if epoll_ctl(s.epollFD, EPOLL_CTL_DEL, fd, nil) != 0:
|
if s.fds[fd].events != {}:
|
||||||
let err = osLastError()
|
if epoll_ctl(s.epollFD, EPOLL_CTL_DEL, fd, nil) != 0:
|
||||||
if err.cint notin {ENOENT, EBADF}:
|
let err = osLastError()
|
||||||
# TODO: Why do we sometimes get an EBADF? Is this normal?
|
if err.cint notin {ENOENT, EBADF}:
|
||||||
raiseOSError(err)
|
# TODO: Why do we sometimes get an EBADF? Is this normal?
|
||||||
|
raiseOSError(err)
|
||||||
s.fds.del(fd)
|
s.fds.del(fd)
|
||||||
|
|
||||||
proc close*(s: var Selector) =
|
proc close*(s: var Selector) =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue