Skip to content

Commit

Permalink
Fixes RobotWebTools#403 v2 : yield infinite lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Alabate committed Jun 14, 2019
1 parent 38e2fbb commit 564cfc9
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 @@ -167,7 +167,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('WebSocketClosedError: Tried to write to a closed websocket')
raise
Expand Down

0 comments on commit 564cfc9

Please sign in to comment.