mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 20:04:18 +00:00
Handle EPOLLHUP to avoid chaos/runaways when using certain file descriptors.
A concrete example is pipe file descriptors: they generate EPOLLHUP instead of a EPOLLIN (then 0 bytes read). The loop will run wild if this event is not handled.
This commit is contained in:
@@ -156,7 +156,7 @@ elif defined(linux):
|
||||
let fd = s.events[i].data.fd.SocketHandle
|
||||
|
||||
var evSet: set[Event] = {}
|
||||
if (s.events[i].events and EPOLLERR) != 0: evSet = evSet + {EvError}
|
||||
if (s.events[i].events and EPOLLERR) != 0 or (s.events[i].events and EPOLLHUP) != 0: evSet = evSet + {EvError}
|
||||
if (s.events[i].events and EPOLLIN) != 0: evSet = evSet + {EvRead}
|
||||
if (s.events[i].events and EPOLLOUT) != 0: evSet = evSet + {EvWrite}
|
||||
let selectorKey = s.fds[fd]
|
||||
|
||||
Reference in New Issue
Block a user