Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def poemReceived(self, poem):
- try:
- self.killer.cancel()
- print "Survived the timeout."
- except AlreadyCalled: # imported from twisted.internet.error
- # It was the killer that caused this call.
- print "Death by timeout"
- self.factory.poem_finished(poem)
- def makeConnection(self, tcp):
- print "Connection made"
- from twisted.internet import reactor
- self.killer = reactor.callLater(self.factory.timeout,
- tcp.loseConnection)
- Protocol.makeConnection(self,tcp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement