Merge pull request #9031 from alaviss/poll-fix

ioselectors_poll: don't pollRemove() if not needed
This commit is contained in:
Dominik Picheta 2018-09-22 10:58:54 +01:00 • committed by GitHub
commit 3717e0e314
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -172,8 +172,9 @@ proc unregister*[T](s: Selector[T], fd: int|SocketHandle) =
doAssert(pkey.ident != InvalidIdent,
"Descriptor [" & $fdi & "] is not registered in the queue!")
pkey.ident = InvalidIdent
pkey.events = {}
s.pollRemove(fdi.cint)
if pkey.events != {}:
pkey.events = {}
s.pollRemove(fdi.cint)
proc unregister*[T](s: Selector[T], ev: SelectEvent) =
let fdi = int(ev.rfd)