Test + fix for epoll and kqueue selector modules to properly unregister
event handles that have the key type "User"
This commit is contained in:
parent
5be8e0b088
commit
adc1419499
3 changed files with 26 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue