fixes based on code review by @dom96

- For clarity: Changed the unregister if statement to use the in operator instead of
the set intersection operator in ioselectors_epoll.nim and
ioselectors_select.nim.

- Fixed unregister of Event.User case on the Android branch.
This commit is contained in:
Ray Imber 2019-10-16 14:13:09 -07:00
commit bef1c4437d
2 changed files with 4 additions and 4 deletions

View file

@ -286,7 +286,7 @@ proc unregister*[T](s: Selector[T], fd: SocketHandle|int) =
s.withSelectLock():
let fd = fd.SocketHandle
var pkey = s.getKey(fd)
if pkey.events * {Event.Read, Event.User} != {}:
if Event.Read in pkey.events or Event.User in pkey.events:
IOFD_CLR(fd, addr s.rSet)
dec(s.count)
if Event.Write in pkey.events:
@ -462,4 +462,4 @@ template withData*[T](s: Selector[T], fd: SocketHandle|int, value,
proc getFd*[T](s: Selector[T]): int =
return -1
return -1