Implement PING/PONG
This commit is contained in:
parent
2e1bc6a6b1
commit
4c7fe56950
1 changed files with 7 additions and 2 deletions
|
@ -31,6 +31,10 @@ 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):
|
||||||
|
command, _, arguments = line.partition(b' ')
|
||||||
|
if command.upper() == b'PING':
|
||||||
|
self.send_line_raw(b'PONG ' + arguments)
|
||||||
|
else:
|
||||||
# TODO: implement line handling
|
# TODO: implement line handling
|
||||||
self.logging_channel.send((logmessage_types.received, line.decode(encoding = 'utf-8', errors = 'replace')))
|
self.logging_channel.send((logmessage_types.received, line.decode(encoding = 'utf-8', errors = 'replace')))
|
||||||
|
|
||||||
|
@ -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