Agent: Fix a bug(peeking socket consumes data)

sock.recv takes two parameters instead of one
This commit is contained in:
vakaris_zilius 2022-09-12 15:01:21 +00:00
parent 191ee1a5f9
commit c2c2993ff7
1 changed files with 3 additions and 1 deletions

View File

@ -26,7 +26,9 @@ class RelayConnectionHandler:
addr, _ = sock.getpeername() addr, _ = sock.getpeername()
addr = IPv4Address(addr) addr = IPv4Address(addr)
control_message = sock.recv(socket.MSG_PEEK) control_message = sock.recv(
len(RELAY_CONTROL_MESSAGE_REMOVE_FROM_WAITLIST), socket.MSG_PEEK
)
if control_message.startswith(RELAY_CONTROL_MESSAGE_REMOVE_FROM_WAITLIST): if control_message.startswith(RELAY_CONTROL_MESSAGE_REMOVE_FROM_WAITLIST):
self._relay_user_handler.disconnect_user(addr) self._relay_user_handler.disconnect_user(addr)