def connectionLost(self, reason):
self.logger.info("Client disconnected")
self.spirit.players.remove(self)
try:
self.session.commit()
if hasattr(self, "room") and self.room is not None:
self.room.remove(self)
if hasattr(self, "user"):
self.session.expunge(self.user)
except InvalidRequestError:
self.logger.info("There aren't any transactions in progress")
finally:
self.session.close()
self.event.emit("disconnected", self, reason)
评论列表
文章目录