Commit f9991e58 authored by Julien Muchembled's avatar Julien Muchembled

Add support for writeable selectable objects

parent 3e207f4d
......@@ -102,7 +102,7 @@ def main():
server_dict[r.fileno()] = r._handle_request_noblock
if server_dict:
while True:
args = server_dict.copy(), []
args = server_dict.copy(), {}, []
server.select(*args)
utils.select(*args)
......
......@@ -90,7 +90,7 @@ class RegistryServer(object):
self.email = self.ca.get_subject().emailAddress
self.onTimeout()
def select(self, r, t):
def select(self, r, w, t):
if self.timeout:
t.append((self.timeout, self.onTimeout))
......
......@@ -186,7 +186,7 @@ class TunnelManager(object):
self._free_iface_list.append(iface)
del self._iface_to_prefix[iface]
def select(self, r, t):
def select(self, r, w, t):
r[self._read_pipe] = self.handleTunnelEvent
r[self.sock] = self.handlePeerEvent
t.append((self._next_refresh, self.refresh))
......
......@@ -28,7 +28,7 @@ class Forwarder(object):
raise UPnPException(str(e))
return wraps(wrapped)(wrapper)
def select(self, r, t):
def select(self, r, w, t):
t.append((self.next_refresh, self.refresh))
def checkExternalIp(self, ip=None):
......
......@@ -165,9 +165,9 @@ class Popen(subprocess.Popen):
return r
def select(R, T):
def select(R, W, T):
try:
r, w, _ = _select.select(R, (), (),
r, w, _ = _select.select(R, W, (),
max(0, min(T)[0] - time.time()) if T else None)
except _select.error as e:
if e.args[0] != errno.EINTR:
......@@ -175,6 +175,8 @@ def select(R, T):
return
for r in r:
R[r]()
for w in w:
W[w]()
t = time.time()
for next_refresh, refresh in T:
if next_refresh <= t:
......
......@@ -425,7 +425,7 @@ def main():
raise ReexecException("Restart to renew certificate")
select_list.append(utils.select)
while True:
args = {}, [(next_renew, renew)]
args = {}, {}, [(next_renew, renew)]
for s in select_list:
s(*args)
finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment