From d7398e1014e90449a02b4ee8b19fe6be16609591 Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Tue, 6 Sep 2022 14:03:17 +0000 Subject: [PATCH] Agent: Move keep_connection into the run() method --- monkey/infection_monkey/network/relay/sockets_pipe.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/infection_monkey/network/relay/sockets_pipe.py b/monkey/infection_monkey/network/relay/sockets_pipe.py index 8031c541d..0b33cb533 100644 --- a/monkey/infection_monkey/network/relay/sockets_pipe.py +++ b/monkey/infection_monkey/network/relay/sockets_pipe.py @@ -20,14 +20,14 @@ class SocketsPipe(Thread): self.source = source self.dest = dest self.timeout = timeout - self._keep_connection = True super().__init__(name=f"SocketsPipeThread-{self.ident}", daemon=True) self._client_disconnected = client_disconnected def run(self): sockets = [self.source, self.dest] - while self._keep_connection: - self._keep_connection = False + keep_connection = True + while keep_connection: + keep_connection = False rlist, _, xlist = select.select(sockets, [], sockets, self.timeout) if xlist: break @@ -42,7 +42,7 @@ class SocketsPipe(Thread): other.sendall(data) except Exception: break - self._keep_connection = True + keep_connection = True self.source.close() self.dest.close()