Ticket #3037: 3037.patch

File 3037.patch, 1.8 KB (added by Zubin Mithra, 9 years ago)

All the changes mentioned above have been made.

  • twisted/internet/abstract.py

     
    149149                return self._postLoseConnection()
    150150            elif self._writeDisconnecting:
    151151                # I was previously asked to to half-close the connection.
     152                self._writeDisconnected = True
    152153                result = self._closeWriteConnection()
    153                 self._writeDisconnected = True
    154154                return result
    155155        return result
    156156
  • twisted/internet/test/test_abstract.py

     
     1from twisted.internet import protocol, interfaces
     2from zope.interface import implements
     3
     4class ListenerProtocol1(protocol.Protocol):
     5    """ Protocol that knows how to deal with connections to our listener """
     6
     7    implements(interfaces.IHalfCloseableProtocol)
     8
     9    def __init__(self):
     10        self.data = []
     11
     12    def dataReceived(self, data):
     13        print "data Received %r" % data
     14
     15    def readConnectionLost(self):
     16        print "readConnectionLost"
     17        self.transport.loseWriteConnection()
     18
     19    def writeConnectionLost(self):
     20        print "writeConnectionLost"
     21        self.transport.loseConnection()
     22
     23    def connectionLost(self, reason):
     24        print "connectionLost"
     25
     26class ListenerFactory(protocol.Factory):
     27    protocol = ListenerProtocol1
     28
     29#from twisted.internet import epollreactor
     30#epollreactor.install()
     31
     32from twisted.internet import reactor
     33port = reactor.listenTCP(5555, ListenerFactory())
     34reactor.run()
     35