ros_comm
ros_comm copied to clipboard
Add optional timeout parameter to rosgraph.is_master_online()
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!