ros_comm icon indicating copy to clipboard operation
ros_comm copied to clipboard

Add optional timeout parameter to rosgraph.is_master_online()

Open rr-tom-noble opened this issue 3 years ago • 0 comments

Fixes #2194 by adding an optional timeout parameter to is_online(). Defaults to None to preserve existing behaviour.

The blocking code seems to come from deep within xmlrpclib, so the easiest way to add a timeout seems to be using socket.setdefaulttimeout(), which is reset after the call to ServerProxy.getPid() is made (within a finally block to ensure cleanup is performed even when an exception is raised).

Let me know if I should add any tests or apply formatting to the code!

rr-tom-noble avatar Oct 20 '21 21:10 rr-tom-noble