当前位置: 首页>>代码示例>>Python>>正文


Python reactor.removeReader函数代码示例

本文整理汇总了Python中twisted.internet.reactor.removeReader函数的典型用法代码示例。如果您正苦于以下问题:Python removeReader函数的具体用法?Python removeReader怎么用?Python removeReader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了removeReader函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connectionMade

    def connectionMade(self):
        sockFD = self.transport.fileno()
        childFDs = {0: sockFD, 1: sockFD}
        if self.factory.stderrFile:
            childFDs[2] = self.factory.stderrFile.fileno()

        # processes run by inetd expect blocking sockets
        # FIXME: maybe this should be done in process.py?  are other uses of
        #        Process possibly affected by this?
        fdesc.setBlocking(sockFD)
        if childFDs.has_key(2):
            fdesc.setBlocking(childFDs[2])

        service = self.factory.service
        uid = service.user
        gid = service.group

        # don't tell Process to change our UID/GID if it's what we
        # already are
        if uid == os.getuid():
            uid = None
        if gid == os.getgid():
            gid = None

        process.Process(None, service.program, service.programArgs, os.environ,
                        None, None, uid, gid, childFDs)

        reactor.removeReader(self.transport)
        reactor.removeWriter(self.transport)
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:29,代码来源:inetd.py

示例2: close

 def close(self):
     reactor.removeReader(self)
     self.sock.setblocking(True)
     self.sock.close()
     self.sock = None
     if self.address.lower() in SCOReader.clients:
         del SCOReader.clients[self.address.lower()]
开发者ID:manuelnaranjo,项目名称:AIRi,代码行数:7,代码来源:bluez.py

示例3: _delegateFD

 def _delegateFD(self):
     # Take out the fd from twisted reactor and pass it to element
     # using it
     # See http://twistedmatrix.com/trac/ticket/1796
     reactor.removeReader(self._transport)
     self._gstElement.connectFd(self._fd)
     self._gstElement.emit('connected')
开发者ID:ApsOps,项目名称:flumotion-orig,代码行数:7,代码来源:protocol.py

示例4: connectionLost

    def connectionLost(self, reason):
        self.sock.close()
        from twisted.internet import reactor

        reactor.removeReader(self)

        reactor.stop()
开发者ID:elenaoat,项目名称:tests,代码行数:7,代码来源:own_twisted_client.py

示例5: _handleNewClient

    def _handleNewClient(self, request):
        # everything fulfilled, serve to client
        fdi = request.fdIncoming
        if not self._writeHeaders(request):
            self.debug("[fd %5d] not adding as a client" % fdi)
            return

        # take over the file descriptor from Twisted by removing them from
        # the reactor
        # spiv told us to remove* on request.transport, and that works
        # then we figured out that a new request is only a Reader, so we
        # remove the removedWriter - this is because we never write to the
        # socket through twisted, only with direct os.write() calls from
        # _writeHeaders.

        # see http://twistedmatrix.com/trac/ticket/1796 for a guarantee
        # that this is a supported way of stealing the socket
        fd = fdi
        self.debug("[fd %5d] taking away from Twisted" % fd)
        reactor.removeReader(request.transport)
        #reactor.removeWriter(request.transport)

        # check if it's really an open fd (i.e. that twisted didn't close it
        # before the removeReader() call)
        try:
            fcntl.fcntl(fd, fcntl.F_GETFL)
        except IOError, e:
            if e.errno == errno.EBADF:
                self.warning("[fd %5d] is not actually open, ignoring" % fd)
            else:
                self.warning("[fd %5d] error during check: %s (%d)" % (
                    fd, e.strerror, e.errno))
            return
开发者ID:ApsOps,项目名称:flumotion-orig,代码行数:33,代码来源:mfdsresources.py

示例6: shutdown

 def shutdown(self):
     print 'shutting down database listener'
     reactor.removeReader(self)
     self.conn.close()
     self.conn = None
     self.corker.stop()
     self.corker = None
开发者ID:ponycloud,项目名称:sparkle,代码行数:7,代码来源:listener.py

示例7: _close

	def _close(self):
		if self.fd is not None:
			fd = self.fd
			self.fd = None
			reactor.removeReader(self)
			fd.close()
			fd = None
开发者ID:smurfix,项目名称:twistfuse,代码行数:7,代码来源:handler.py

示例8: connectionLost

    def connectionLost(self, reason):
        self.socket.close()

        # stop monitoring this socket
        from twisted.internet import reactor

        reactor.removeReader(self)
开发者ID:aircable,项目名称:AIRi,代码行数:7,代码来源:airidroid.py

示例9: shutdown

 def shutdown(self):
     """Prepares the EQ to be closed."""
     self._inotify_notifier_gral.stop()
     self._inotify_notifier_antr.stop()
     reactor.removeReader(self._inotify_reader_gral)
     reactor.removeReader(self._inotify_reader_antr)
     self._processor.shutdown()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:7,代码来源:filesystem_notifications.py

示例10: connectionLost

    def connectionLost(self,reason):
        self.sock.close()

        reactor.removeReader(self)

        for reader in reactor.getReaders():
            if isinstance(reader,PoetrySocket):
                return
        reactor.stop()
开发者ID:chen19901225,项目名称:SimplePyCode,代码行数:9,代码来源:get_poetry.py

示例11: SCO_Data

 def SCO_Data(self, sock, lost=False):
     if lost:
         reactor.removeReader(self.sco_socket)
         return
     self.buffer += sock.recv(bluetooth.sco_mtu)
     if len(self.buffer) >= 400:
         from airi.stream import MultiPartStream
         MultiPartStream.sendToClients(self.buffer,
             mime="application/octet-stream")
         self.buffer = ""
开发者ID:manuelnaranjo,项目名称:AIRi,代码行数:10,代码来源:airicamera.py

示例12: doRead

	def doRead(self):
		reactor.removeReader(self)
		try:
			fd = recvfd(self.fd)[0]
		except Exception as e:
			self._close()
			self.proc.got_no_fd(e)
		else:
			self._close()
			self.proc.got_fd(fd)
开发者ID:smurfix,项目名称:twistfuse,代码行数:10,代码来源:handler.py

示例13: release

    def release(self):
        reactor.removeReader(self)
        if hasattr(self, '_fd') and self._fd >= 0:
            try:
                os.close(self._fd)
            except OSError:
                pass

        if hasattr(INotify, '_instance_'):
            del INotify._instance_
开发者ID:AndyThirtover,项目名称:wb_gateway,代码行数:10,代码来源:inotify.py

示例14: dataReceived

    def dataReceived(self, data):
        """
        Overridden to stop trying to read data while outputting a response.

        This stops netcat from quitting before it gets the output!
        """
        reactor.removeReader(self.reader)
        retval = LineOnlyReceiver.dataReceived(self, data)
        reactor.getThreadPool().callInThreadWithCallback(
            self.processLinesDone, self.processLines)
        return retval
开发者ID:RIPE-NCC,项目名称:ripestat-text,代码行数:11,代码来源:server.py

示例15: release

    def release(self):
        """
        Release the inotify file descriptor and do the necessary cleanup
        """
        reactor.removeReader(self)
        if hasattr(self, '_fd') and self._fd >= 0:
            try:
                os.close(self._fd)
            except OSError:
                pass

        if hasattr(INotify, '_instance_'):
            del INotify._instance_
开发者ID:BlackHole,项目名称:coherence,代码行数:13,代码来源:inotify.py


注:本文中的twisted.internet.reactor.removeReader函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。