Advertisement
felipeo

Poem Client Timeout

Jun 26th, 2011
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1.     def poemReceived(self, poem):
  2.         try:
  3.             self.killer.cancel()
  4.         except AlreadyCalled: # imported from twisted.internet.error
  5.             # It was the killer that caused this call.
  6.             pass
  7.         print "Cancelling Killer"
  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