Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HTTP for kernel < 4.16 #2132

Merged
merged 9 commits into from
Mar 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions tools/rosgraph/src/rosgraph/xmlrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,32 @@ def isstring(s):
except NameError:
return isinstance(s, str)

class SilenceableXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):

protocol_version = 'HTTP/1.1'
def check_kernel(major, minor):
"""Small helper version to check that the current platform kernel is a
jikawa-az marked this conversation as resolved.
Show resolved Hide resolved
newer or the same as the input
"""
release = platform.release().split('.')
jikawa-az marked this conversation as resolved.
Show resolved Hide resolved

platform_major = int(release[0])
platform_minor = int(release[1])

if platform_major > major:
jikawa-az marked this conversation as resolved.
Show resolved Hide resolved
return True
elif platform_major < major:
return False

if platform_minor > minor:
return True
elif platform_minor < minor:
return False

return True


class SilenceableXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
if check_kernel(4,16):
jikawa-az marked this conversation as resolved.
Show resolved Hide resolved
protocol_version = 'HTTP/1.1'

def log_message(self, format, *args):
if 0:
Expand All @@ -90,7 +113,8 @@ class ThreadingXMLRPCServer(socketserver.ThreadingMixIn, SimpleXMLRPCServer):
requests via threading. Also makes logging toggleable.
"""

daemon_threads = True
if check_kernel(4,16):
daemon_threads = True

def __init__(self, addr, log_requests=1):
"""
Expand Down