roslib: make xmlrpc server more robust to signals
This commit is contained in:
parent
1450c4a03a
commit
5c6c008862
|
@ -231,9 +231,18 @@ class XmlRpcNode(object):
|
|||
if self.handler is not None:
|
||||
self.handler._ready(self.uri)
|
||||
logger.info("xml rpc node: starting XML-RPC server")
|
||||
try:
|
||||
self.server.serve_forever()
|
||||
except:
|
||||
# ignore on shutdown
|
||||
if not self.is_shutdown:
|
||||
raise
|
||||
while not self.is_shutdown:
|
||||
try:
|
||||
self.server.serve_forever()
|
||||
except IOError as (errno, errstr):
|
||||
# check for interrupted call, which can occur if we're
|
||||
# embedded in a program using signals. All other
|
||||
# exceptions break _run.
|
||||
if errno != 4:
|
||||
self.is_shutdown = True
|
||||
logger.error("serve forever IOError: %s, %s"%(errno, errstr))
|
||||
# re-raise
|
||||
raise
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue