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 e87da8b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 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,7 +374,9 @@ def rosnode_ping(node_name, max_count=None, verbose=False, skip_cache=False):
time.sleep(1.0)
except KeyboardInterrupt:
pass

finally:
node.__exit__()

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

0 comments on commit e87da8b

Please sign in to comment.