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


Python abstract.FileDescriptor类代码示例

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


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

示例1: close

 def close(self):
     """
     @summary:  Close raw layer
                 Use File descriptor directly to not use TLS close
                 Because is bugged
     """
     FileDescriptor.loseConnection(self.transport)
开发者ID:dnozay,项目名称:rdpy,代码行数:7,代码来源:layer.py

示例2: __init__

 def __init__(self, dispatcher, skt):
     FileDescriptor.__init__(self, dispatcher.reactor)
     self.status = None
     self.dispatcher = dispatcher
     self.skt = skt          # XXX needs to be set non-blocking by somebody
     self.fileno = skt.fileno
     self.outgoingSocketQueue = []
开发者ID:azbarcea,项目名称:calendarserver,代码行数:7,代码来源:sendfdport.py

示例3: connectionLost

 def connectionLost(self, reason):
     if self.tunfd >= 0:
         try:
             os.close(self.tunfd)
         except OSError as _:
             logger.error("cannot close tunfd")
     FileDescriptor.connectionLost(self, reason)
开发者ID:alexsunday,项目名称:pyvpn,代码行数:7,代码来源:server.py

示例4: __init__

    def __init__(self, protocol, device, reactor = None):
        FileDescriptor.__init__(self, reactor = reactor)
        self.protocol = protocol
        self.protocol.makeConnection(self)
        self.__device = open(device, "r+w+")

        self.reading = False
        self.backToReading = False
开发者ID:buben19,项目名称:twistedinput,代码行数:8,代码来源:device.py

示例5: connectionLost

 def connectionLost(self, reason):
     """
     The connection was lost.
     """
     FileDescriptor.connectionLost(self, reason)
     self.protocol.connectionLost(reason)
     self.connected = 0
     if self._fd is not None:
         os.close(self._fd)
开发者ID:Valodim,项目名称:irclogd,代码行数:9,代码来源:fifo.py

示例6: _simpleSetup

    def _simpleSetup(self):
        reactor = self.buildReactor()

        client, server = self._connectedPair()

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

        return reactor, fd, server
开发者ID:svpcom,项目名称:twisted-cdeferred,代码行数:9,代码来源:test_fdset.py

示例7: __init__

 def __init__(self, group, reactor=None):
     FileDescriptor.__init__(self, reactor)
     self.wrapper = NFLog()
     self.wrapper.open()
     self.wrapper.bindProtocolFamily(AF_INET)
     self.group = group
     self.wrapper.bindGroup(group)
     self.wrapper.setMode(NFULNL_COPY_PACKET, 0xFFFF)
     self.wrapper.setCallback(self.nflogCallback)
开发者ID:alessandrod,项目名称:cattivo,代码行数:9,代码来源:server.py

示例8: write

 def write(self, bytes):
     """
     Write some bytes to this connection, passing them through a TLS layer if
     necessary, or discarding them if the connection has already been lost.
     """
     if self.TLS:
         if self.connected:
             self.protocol.write(bytes)
     else:
         FileDescriptor.write(self, bytes)
开发者ID:0004c,项目名称:VTK,代码行数:10,代码来源:_newtls.py

示例9: startReading

 def startReading(self):
     """
     Start waiting for read availability
     """
     if self.connected:
         FileDescriptor.startReading(self)
         return
     self._fd = os.open(self.path, os.O_RDONLY | os.O_NONBLOCK)
     self.connected = 1
     FileDescriptor.startReading(self)
开发者ID:Valodim,项目名称:irclogd,代码行数:10,代码来源:fifo.py

示例10: connectionLost

 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.")
开发者ID:0004c,项目名称:VTK,代码行数:10,代码来源:inotify.py

示例11: __init__

 def __init__(self, dispatcher, inSocket, outSocket, status, slavenum):
     FileDescriptor.__init__(self, dispatcher.reactor)
     self.status = status
     self.slavenum = slavenum
     self.dispatcher = dispatcher
     self.inSocket = inSocket
     self.outSocket = outSocket   # XXX needs to be set non-blocking by somebody
     self.fileno = outSocket.fileno
     self.outgoingSocketQueue = []
     self.pendingCloseSocketQueue = []
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:10,代码来源:sendfdport.py

示例12: unregisterProducer

    def unregisterProducer(self):
        """
        Unregister a producer.

        If TLS is enabled, the TLS connection handles this.
        """
        if self.TLS:
            self.protocol.unregisterProducer()
        else:
            FileDescriptor.unregisterProducer(self)
开发者ID:0004c,项目名称:VTK,代码行数:10,代码来源:_newtls.py

示例13: loseConnection

    def loseConnection(self):
        """
        Close this connection after writing all pending data.

        If TLS has been negotiated, perform a TLS shutdown.
        """
        if self.TLS:
            if self.connected and not self.disconnecting:
                self.protocol.loseConnection()
        else:
            FileDescriptor.loseConnection(self)
开发者ID:0004c,项目名称:VTK,代码行数:11,代码来源:_newtls.py

示例14: writeSequence

 def writeSequence(self, iovec):
     """
     Write some bytes to this connection, scatter/gather-style, passing them
     through a TLS layer if necessary, or discarding them if the connection
     has already been lost.
     """
     if self.TLS:
         if self.connected:
             self.protocol.writeSequence(iovec)
     else:
         FileDescriptor.writeSequence(self, iovec)
开发者ID:0004c,项目名称:VTK,代码行数:11,代码来源:_newtls.py

示例15: write

 def write(self, bytes):
     """
     Write some bytes to this connection, passing them through a TLS layer if
     necessary, or discarding them if the connection has already been lost.
     """
     if self.TLS:
         if self.connected:
             self.protocol.write(bytes)
     elif self._tlsWaiting is not None:
         self._tlsWaiting.bufferedData.append(bytes)
     else:
         FileDescriptor.write(self, bytes)
开发者ID:Juxi,项目名称:OpenSignals,代码行数:12,代码来源:_newtls.py


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