Skip to content

Commit

Permalink
Remove unavailable nodes from local node cache _caller_apis (#2010)
Browse files Browse the repository at this point in the history
* rosnode_cleanup() now also removes unavailable nodes from the local node cache _caller_apis. This prevents buggy behaviour when nodes become unvailable because they exit the ros network due to wifi issues but then reconnect to it later on.

* Fixed indentation
  • Loading branch information
bofetadas authored and jacobperron committed Oct 22, 2020
1 parent f71dbd7 commit d90e4bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/rosnode/src/rosnode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def rosnode_ping_all(verbose=False, skip_cache=False):

def cleanup_master_blacklist(master, blacklist):
"""
Remove registrations from ROS Master that match blacklist.
Remove registrations from ROS Master and node cache (_caller_apis) that match blacklist.
@param master: rosgraph Master instance
@type master: rosgraph.Master
@param blacklist: list of nodes to scrub
Expand All @@ -427,6 +427,7 @@ def cleanup_master_blacklist(master, blacklist):
service_api = master.lookupService(s)
master_n = rosgraph.Master(n)
master_n.unregisterService(s, service_api)
_caller_apis.pop(n, None)

def cleanup_master_whitelist(master, whitelist):
"""
Expand Down

0 comments on commit d90e4bf

Please sign in to comment.