예제 #1
0
 def testLoopback(self):
     protocol =  MyVirtualPOP3()
     protocol.service = self.factory
     clientProtocol = MyPOP3Downloader()
     loopback.loopback(protocol, clientProtocol)
     self.failUnlessEqual(clientProtocol.message, self.message)
     protocol.connectionLost(failure.Failure(Exception("Test harness disconnect")))
예제 #2
0
 def testLoopback(self):
     protocol = MyVirtualPOP3()
     protocol.service = self.factory
     clientProtocol = MyPOP3Downloader()
     loopback.loopback(protocol, clientProtocol)
     self.failUnlessEqual(clientProtocol.message, self.message)
     protocol.connectionLost(
         failure.Failure(Exception("Test harness disconnect")))
예제 #3
0
 def removeProtocol(self, protocol):
     if protocol in self._protocols:
         log.msg('_EpicsBufferSubscriptionProtocol: removeProtocol: Remove protocol: %(p)s', p=protocol, logLevel=_DEBUG)
         # Do not unsubscribe, the buffer will live for the life of the server! Maybe a timeout is required instead.
         protocol.connectionLost("Connection closed cleanly")
         self._protocols.remove(protocol)
         
     else:
         log.msg('_EpicsBufferSubscriptionProtocol: removeProtocol: Protocol not found %(p)s', p=protocol, logLevel=_WARN)
예제 #4
0
파일: tcp.py 프로젝트: galaxysd/BitTorrent
 def connectionLost(self, reason):
     """See abstract.FileDescriptor.connectionLost().
     """
     abstract.FileDescriptor.connectionLost(self, reason)
     self._closeSocket()
     protocol = self.protocol
     del self.protocol
     del self.socket
     del self.fileno
     protocol.connectionLost(reason)
예제 #5
0
파일: tcp.py 프로젝트: UstadMobile/eXePUB
 def connectionLost(self, reason):
     """See abstract.FileDescriptor.connectionLost().
     """
     abstract.FileDescriptor.connectionLost(self, reason)
     self._closeSocket()
     protocol = self.protocol
     del self.protocol
     del self.socket
     del self.fileno
     protocol.connectionLost(reason)
예제 #6
0
    def removeProtocol(self, protocol):
        if protocol in self._protocols:
            log.msg('EpicsSubscriptionProtocol: removeProtocol: Remove protocol: %(p)s', p=protocol, logLevel=_DEBUG)
            protocol.connectionLost("Connection closed cleanly")
            self._protocols.remove(protocol)

            if len(self._protocols) == 0:
                log.msg('EpicsSubscriptionProtocol: removeProtocol: No protocols remaining, so loseConnection', logLevel=_DEBUG)
                self.transport.loseConnection()
                self._subscription.unsubscribe()
            
        else:
            log.msg('EpicsSubscriptionProtocol: removeProtocol: Protocol not found %(p)s', p=protocol, logLevel=_WARN)
예제 #7
0
파일: tcp.py 프로젝트: fxia22/ASM_xf
 def connectionLost(self, reason):
     """See abstract.FileDescriptor.connectionLost().
     """
     abstract.FileDescriptor.connectionLost(self, reason)
     self._closeSocket()
     protocol = self.protocol
     del self.protocol
     del self.socket
     del self.fileno
     try:
         protocol.connectionLost(reason)
     except TypeError, e:
         # while this may break, it will only break on deprecated code
         # as opposed to other approaches that might've broken on
         # code that uses the new API (e.g. inspect).
         if e.args and e.args[0] == "connectionLost() takes exactly 1 argument (2 given)":
             warnings.warn("Protocol %s's connectionLost should accept a reason argument" % protocol,
                           category=DeprecationWarning, stacklevel=2)
             protocol.connectionLost()
         else:
             raise
예제 #8
0
 def connectionLost(self, reason):
     self._connected = False
     log.msg('DistributingProtocol: connectionLost: Reason is %(r)s', r=reason, logLevel=_TRACE)
     for protocol in self._protocols:
         log.msg('DistributingProtocol: connectionLost: Distribute to %(p)s', p=protocol, logLevel=_TRACE)
         protocol.connectionLost(reason)
예제 #9
0
 def check(ignored):
     self.assertEqual(clientProtocol.message, self.message)
     protocol.connectionLost(
         failure.Failure(Exception("Test harness disconnect")))
예제 #10
0
 def check(ignored):
     self.assertEqual(clientProtocol.message, self.message)
     protocol.connectionLost(
         failure.Failure(Exception("Test harness disconnect")))