Skip to content

Commit

Permalink
Fix error reporting TCPROSServer
Browse files Browse the repository at this point in the history
  • Loading branch information
g-gemignani committed Nov 18, 2022
1 parent bc33f0c commit 9d7b6d2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions clients/rospy/src/rospy/impl/tcpros_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,21 @@ def _tcp_server_callback(self, sock, client_addr):
header = read_ros_handshake_header(sock, StringIO(), buff_size)
else:
header = read_ros_handshake_header(sock, BytesIO(), buff_size)

if 'topic' in header:
err_msg = self.topic_connection_handler(sock, client_addr, header)
elif 'service' in header:
err_msg = self.service_connection_handler(sock, client_addr, header)
else:
err_msg = 'no topic or service name detected'

if isinstance(err_msg, dict):
err_msg = err_msg.get('error', 'unhandled connection')

if err_msg:
# shutdown race condition: nodes that come up and down
# quickly can receive connections during teardown.

# We use is_shutdown_requested() because we can get
# into bad connection states during client shutdown
# hooks.
Expand Down

0 comments on commit 9d7b6d2

Please sign in to comment.