Advertisement
felipeo

Untitled

Jun 26th, 2011
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1.     def poemReceived(self, poem):
  2.         try:
  3.             self.killer.cancel()
  4.             print "Survived the timeout."
  5.         except AlreadyCalled: # imported from twisted.internet.error
  6.             # It was the killer that caused this call.
  7.             print "Death by timeout"
  8.         self.factory.poem_finished(poem)
  9.  
  10.     def makeConnection(self, tcp):
  11.         print "Connection made"
  12.         from twisted.internet import reactor
  13.         self.killer = reactor.callLater(self.factory.timeout,
  14.                                         tcp.loseConnection)
  15.         Protocol.makeConnection(self,tcp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement