From 1845e05a34665c3dace740a953065f535ec66fc6 Mon Sep 17 00:00:00 2001 From: Elie Zedeck Date: Wed, 21 Jan 2015 18:15:38 +0300 Subject: 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. --- lib/pure/selectors.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pure/selectors.nim b/lib/pure/selectors.nim index 29f6cd3ab..bd2564937 100644 --- a/lib/pure/selectors.nim +++ b/lib/pure/selectors.nim @@ -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] -- cgit 1.4.1-2-gfad0 >
summary refs log tree commit diff stats
path: root/.travis.yml
blob: a3fa3f1da115e242e6085c12d061428d4f0dbcb8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52