Skip to content

Commit

Permalink
rosnode: Fix unclosed socket in rosnode_ping command
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoM17 committed Dec 6, 2024
1 parent 8250c7d commit a8a0c48
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tools/rosnode/src/rosnode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ def rosnode_ping(node_name, max_count=None, verbose=False, skip_cache=False):
if verbose:
print("node url has changed from [%s] to [%s], retrying to ping"%(node_api, new_node_api))
node_api = new_node_api
node.__exit__()
node = ServerProxy(node_api)
continue
print("ERROR: connection refused to [%s]"%(node_api), file=sys.stderr)
Expand All @@ -373,10 +374,12 @@ def rosnode_ping(node_name, max_count=None, verbose=False, skip_cache=False):
time.sleep(1.0)
except KeyboardInterrupt:
pass

if verbose and count > 1:
print("ping average: %fms"%(acc/count))
return True

if verbose and count > 1:
print("ping average: %fms"%(acc/count))
return True
finally:
node.__exit__()

def rosnode_ping_all(verbose=False, skip_cache=False):
"""
Expand Down

0 comments on commit a8a0c48

Please sign in to comment.