Implement PING/PONG
This commit is contained in:
parent
2e1bc6a6b1
commit
4c7fe56950
1 changed files with 7 additions and 2 deletions
|
@ -31,8 +31,12 @@ class ServerThread(threading.Thread):
|
||||||
self.logging_channel.send((logmessage_types.sent, line.decode(encoding = 'utf-8', errors = 'replace')))
|
self.logging_channel.send((logmessage_types.sent, line.decode(encoding = 'utf-8', errors = 'replace')))
|
||||||
|
|
||||||
def handle_line(self, line):
|
def handle_line(self, line):
|
||||||
# TODO: implement line handling
|
command, _, arguments = line.partition(b' ')
|
||||||
self.logging_channel.send((logmessage_types.received, line.decode(encoding = 'utf-8', errors = 'replace')))
|
if command.upper() == b'PING':
|
||||||
|
self.send_line_raw(b'PONG ' + arguments)
|
||||||
|
else:
|
||||||
|
# TODO: implement line handling
|
||||||
|
self.logging_channel.send((logmessage_types.received, line.decode(encoding = 'utf-8', errors = 'replace')))
|
||||||
|
|
||||||
def mainloop(self):
|
def mainloop(self):
|
||||||
# Register both the server socket and the control channel to or polling object
|
# Register both the server socket and the control channel to or polling object
|
||||||
|
@ -43,6 +47,7 @@ class ServerThread(threading.Thread):
|
||||||
# Keep buffer for input
|
# Keep buffer for input
|
||||||
server_input_buffer = bytearray()
|
server_input_buffer = bytearray()
|
||||||
|
|
||||||
|
# TODO: Implement timeouting
|
||||||
quitting = False
|
quitting = False
|
||||||
while not quitting:
|
while not quitting:
|
||||||
# Wait until we can do something
|
# Wait until we can do something
|
||||||
|
|
Loading…
Reference in a new issue