def _on_message_finish(self, message, **kwargs): self.trigger(event.RESUME, conn=self) self.in_flight -= 1 try: self.send(protocol.finish(message.id)) except Exception, e: self.close() self.trigger( event.ERROR, conn=self, error=protocol.SendError('failed to send FIN %s' % message.id, e), )