本文整理汇总了Python中message.Message.is_disconnect方法的典型用法代码示例。如果您正苦于以下问题:Python Message.is_disconnect方法的具体用法?Python Message.is_disconnect怎么用?Python Message.is_disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message.Message
的用法示例。
在下文中一共展示了Message.is_disconnect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: serve
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import is_disconnect [as 别名]
def serve(self):
recv_sock = self.ctx.socket(zmq.PULL)
recv_sock.connect(self.recv)
self.log.debug("Using PULL socket %s" % self.recv)
send_sock = self.ctx.socket(zmq.PUB)
send_sock.connect(self.send)
self.log.debug("Using PUB socket %s" % self.send)
self.log.info("All set, ready to serve requests...")
while True:
m2message = Message(recv_sock.recv())
if m2message.is_disconnect():
self.log.debug("Disconnect message received, id=%s" % m2message.client_id)
continue
# Call the app and send the response back to mongrel2
self._call_wsgi_app(m2message, send_sock)
示例2: serve
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import is_disconnect [as 别名]
def serve(self):
'''
Start serving requests.
'''
self.log.debug("Setting up ZMQ endpoints")
send_sock, recv_sock = self._setup_zmq_endpoints()
self.log.info("All set, ready to serve requests...")
while self._should_serve():
self.log.debug("Serving requests...")
m2message = Message(recv_sock.recv())
self.log.debug("Request arrived... headers={0}".format(m2message.headers))
if m2message.is_disconnect():
self.log.debug("Disconnect message received, id=%s" % m2message.client_id)
continue
if m2message.is_upload_start():
self.log.debug("Starting async upload, file will be at: {0}".format(m2message.async_upload_path))
continue
# Call the app and send the response back to mongrel2
self._call_wsgi_app(m2message, send_sock)