Test + fix for epoll and kqueue selector modules to properly unregister

event handles that have the key type "User"
This commit is contained in:
Ray Imber 2019-10-06 16:02:12 -07:00
commit adc1419499
3 changed files with 26 additions and 3 deletions

View file

@ -375,7 +375,7 @@ proc unregister*[T](s: Selector[T], fd: int|SocketHandle) =
"Descriptor [" & $fdi & "] is not registered in the queue!")
if pkey.events != {}:
if pkey.events * {Event.Read, Event.Write} != {}:
if pkey.events * {Event.Read, Event.Write, Event.User} != {}:
if Event.Read in pkey.events:
modifyKQueue(s, uint(fdi), EVFILT_READ, EV_DELETE, 0, 0, nil)
dec(s.count)
@ -632,4 +632,4 @@ template withData*[T](s: Selector[T], fd: SocketHandle|int, value, body1,
proc getFd*[T](s: Selector[T]): int =
return s.kqFD.int
return s.kqFD.int