Revision 376a8634 vncauthproxy/proxy.py

b/vncauthproxy/proxy.py
50 50

  
51 51
logger = None
52 52

  
53
# Currently, gevent uses libevent-dns for asynchornous DNS resolution,
54
# which opens a socket upon initialization time. Since we can't get the fd
55
# reliably, We have to maintain all file descriptors open (which won't harm
56
# anyway)
57

  
58
class AllFilesDaemonContext(daemon.DaemonContext):
59
    """DaemonContext class keeping all file descriptors open"""
60
    def _get_exclude_file_descriptors(self):
61
        class All:
62
            def __contains__(self, value):
63
                return True
64
        return All()
65

  
66

  
53 67
class VncAuthProxy(gevent.Greenlet):
54 68
    """
55 69
    Simple class implementing a VNC Forwarder with MITM authentication as a
......
428 442
    # Redirect stdout and stderr to handler.stream to catch
429 443
    # early errors in the daemonization process [e.g., pidfile creation]
430 444
    # which will otherwise go to /dev/null.
431
    daemon_context = daemon.DaemonContext(
445
    daemon_context = AllFilesDaemonContext(
432 446
        pidfile=pidf,
433 447
        umask=0022,
434 448
        stdout=handler.stream,

Also available in: Unified diff