##// END OF EJS Templates
handle message arriving when sockets are closed...
Min RK -
Show More
@@ -106,12 +106,11 b' class ZMQStreamHandler(WebSocketHandler):'
106 # we can close the connection more gracefully.
106 # we can close the connection more gracefully.
107 self.stream.close()
107 self.stream.close()
108
108
109
109
110 def check_origin(self, origin):
110 def check_origin(self, origin):
111 """Check Origin == Host or Access-Control-Allow-Origin.
111 """Check Origin == Host or Access-Control-Allow-Origin.
112
112
113 Tornado >= 4 calls this method automatically, raising 403 if it returns False.
113 Tornado >= 4 calls this method automatically, raising 403 if it returns False.
114 We call it explicitly in `open` on Tornado < 4.
115 """
114 """
116 if self.allow_origin == '*':
115 if self.allow_origin == '*':
117 return True
116 return True
@@ -173,7 +172,10 b' class ZMQStreamHandler(WebSocketHandler):'
173 def _on_zmq_reply(self, stream, msg_list):
172 def _on_zmq_reply(self, stream, msg_list):
174 # Sometimes this gets triggered when the on_close method is scheduled in the
173 # Sometimes this gets triggered when the on_close method is scheduled in the
175 # eventloop but hasn't been called.
174 # eventloop but hasn't been called.
176 if stream.closed(): return
175 if self.stream.closed() or stream.closed():
176 self.log.warn("zmq message arrived on closed channel")
177 self.close()
178 return
177 channel = getattr(stream, 'channel', None)
179 channel = getattr(stream, 'channel', None)
178 try:
180 try:
179 msg = self._reserialize_reply(msg_list, channel=channel)
181 msg = self._reserialize_reply(msg_list, channel=channel)
General Comments 0
You need to be logged in to leave comments. Login now