File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ def changed(fname):
113
113
[util .close_on_exec (s ) for s in self .sockets ]
114
114
util .close_on_exec (self .tmp .fileno ())
115
115
116
+ self .wait_fds = self .sockets + [self .PIPE [0 ]]
117
+
116
118
self .log .close_on_exec ()
117
119
118
120
self .init_signals ()
@@ -164,6 +166,9 @@ def init_signals(self):
164
166
signal .siginterrupt (signal .SIGTERM , False )
165
167
signal .siginterrupt (signal .SIGUSR1 , False )
166
168
169
+ if hasattr (signal , 'set_wakeup_fd' ):
170
+ signal .set_wakeup_fd (self .PIPE [1 ])
171
+
167
172
def handle_usr1 (self , sig , frame ):
168
173
self .log .reopen_files ()
169
174
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def accept(self, listener):
32
32
def wait (self , timeout ):
33
33
try :
34
34
self .notify ()
35
- ret = select .select (self .sockets , [], self . PIPE , timeout )
35
+ ret = select .select (self .wait_fds , [], [] , timeout )
36
36
if ret [0 ]:
37
37
return ret [0 ]
38
38
@@ -93,6 +93,9 @@ def run_for_multiple(self, timeout):
93
93
94
94
if ready is not None :
95
95
for listener in ready :
96
+ if listener == self .PIPE [0 ]:
97
+ continue
98
+
96
99
try :
97
100
self .accept (listener )
98
101
except EnvironmentError as e :
You can’t perform that action at this time.
0 commit comments