Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ############ 1st Attempt ############
- def connectionLost(self, reason):
- if self.dead: # Only set by callLater used to time out
- self.factory.clientConnectionFailed(
- self.transport,
- Failure(TimeOutError(self.factory.timeout),
- TimeOutError,
- reason.getTracebackObject())) # also tried reason.tb here :(
- else:
- self.killer.cancel()
- self.poemReceived(self.poem)
- ############ 2nd Attempt: ###########
- def connectionLost(self, reason):
- if self.dead:
- try:
- try:
- reason.raiseException()
- except: # This makes me very uncomfortable!
- raise TimeOutError(self.factory.timeout)
- except TimeOutError:
- self.factory.clientConnectionFailed(self.transport,
- Failure())
- else:
- self.killer.cancel()
- self.poemReceived()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement