Minor fixes for protocol specification
This commit is contained in:
parent
0991aad105
commit
320044f4b8
@ -79,17 +79,8 @@ class BankWorker(multiprocessing.Process):
|
|||||||
elif "\r" in buffer:
|
elif "\r" in buffer:
|
||||||
ending = "\r"
|
ending = "\r"
|
||||||
self.logger.debug("CR detected")
|
self.logger.debug("CR detected")
|
||||||
|
|
||||||
elif len(buffer) == 2 or len(buffer) >= 16:
|
|
||||||
# If no line ending is provided, make an assumption
|
|
||||||
# Either a 2 character command was sent without any line ending
|
|
||||||
# or the shorted valid command with arguments has to be 16 or more
|
|
||||||
# characters long
|
|
||||||
ending = "\n"
|
|
||||||
self.logger.debug("Messages appear to be missing line ending, proceeding with processing")
|
|
||||||
|
|
||||||
if ending is None:
|
if ending is None:
|
||||||
self.logger.debug("No line ending found, and messages don't look complete. Assuming another part will come")
|
self.logger.debug("No line ending found. Assuming another part will come")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
response = self.process_request(buffer, ending)
|
response = self.process_request(buffer, ending)
|
||||||
|
@ -38,7 +38,7 @@ class BankScanner(threading.Thread):
|
|||||||
self.logger.debug("Unknown error occurred when probing port: %s", e)
|
self.logger.debug("Unknown error occurred when probing port: %s", e)
|
||||||
|
|
||||||
def __scan_for_bank(self, connection: socket.socket):
|
def __scan_for_bank(self, connection: socket.socket):
|
||||||
ping_command = "BC"
|
ping_command = "BC\r\n"
|
||||||
connection.sendall(ping_command.encode("utf-8"))
|
connection.sendall(ping_command.encode("utf-8"))
|
||||||
response = connection.recv(1024).decode("utf-8")
|
response = connection.recv(1024).decode("utf-8")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user