Exemplo n.º 1
0
    def _simpleSetup(self):
        reactor = self.buildReactor()

        client, server = self._connectedPair()

        fd = FileDescriptor(reactor)
        fd.fileno = client.fileno

        return reactor, fd, server
Exemplo n.º 2
0
 def connectionLost(self, reason):
     """
     Release the inotify file descriptor and do the necessary cleanup
     """
     FileDescriptor.connectionLost(self, reason)
     if self._fd >= 0:
         try:
             os.close(self._fd)
         except OSError, e:
             log.err(e, "Couldn't close INotify file descriptor.")
Exemplo n.º 3
0
 def connectionLost(self, reason):
     """
     Release the inotify file descriptor and do the necessary cleanup
     """
     FileDescriptor.connectionLost(self, reason)
     if self._fd >= 0:
         try:
             os.close(self._fd)
         except OSError, e:
             log.err(e, "Couldn't close INotify file descriptor.")
Exemplo n.º 4
0
    def __init__(self, reactor=None):
        FileDescriptor.__init__(self, reactor=reactor)

        # Smart way to allow parametrization of libc so I can override
        # it and test for the system errors.
        self._fd = self._inotify.init()

        fdesc.setNonBlocking(self._fd)
        fdesc._setCloseOnExec(self._fd)

        # The next 2 lines are needed to have self.loseConnection()
        # to call connectionLost() on us. Since we already created the
        # fd that talks to inotify we want to be notified even if we
        # haven't yet started reading.
        self.connected = 1
        self._writeDisconnected = True

        self._buffer = ''
        self._watchpoints = {}
        self._watchpaths = {}
Exemplo n.º 5
0
    def __init__(self, reactor=None):
        FileDescriptor.__init__(self, reactor=reactor)

        # Smart way to allow parametrization of libc so I can override
        # it and test for the system errors.
        self._fd = self._inotify.init()

        fdesc.setNonBlocking(self._fd)
        fdesc._setCloseOnExec(self._fd)

        # The next 2 lines are needed to have self.loseConnection()
        # to call connectionLost() on us. Since we already created the
        # fd that talks to inotify we want to be notified even if we
        # haven't yet started reading.
        self.connected = 1
        self._writeDisconnected = True

        self._buffer = ''
        self._watchpoints = {}
        self._watchpaths = {}