Skip to content

Commit

Permalink
Fixes #403 v2 : yield infinite lock (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alabate authored and Jihoon Lee committed Jun 25, 2019
1 parent 9255ef4 commit 34ea8ae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rosbridge_server/src/rosbridge_server/websocket_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,14 @@ def prewrite_message(self, message, binary):
# Use a try block because the log decorator doesn't cooperate with @coroutine.
try:
with self._write_lock:
yield self.write_message(message, binary)
future = self.write_message(message, binary)

# When closing, self.write_message() return None even if it's an undocument output.
# Consider it as WebSocketClosedError
if future is None:
raise WebSocketClosedError

yield future
except WebSocketClosedError:
rospy.logwarn_throttle(1, 'WebSocketClosedError: Tried to write to a closed websocket')
raise
Expand Down

0 comments on commit 34ea8ae

Please sign in to comment.