From 813c5f9d3bf258a606fb29b2f38d6559378365d7 Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Tue, 6 Sep 2022 19:16:49 +0000 Subject: [PATCH] Agent: Clarify exceptions in SocketsPipe._pipe() --- monkey/infection_monkey/network/relay/sockets_pipe.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/monkey/infection_monkey/network/relay/sockets_pipe.py b/monkey/infection_monkey/network/relay/sockets_pipe.py index ff8e82c04..ccb051252 100644 --- a/monkey/infection_monkey/network/relay/sockets_pipe.py +++ b/monkey/infection_monkey/network/relay/sockets_pipe.py @@ -28,13 +28,12 @@ class SocketsPipe(Thread): def _pipe(self): sockets = [self.source, self.dest] while True: - # TODO: Figure out how to capture when the socket times out. read_list, _, except_list = select.select(sockets, [], sockets, self.timeout) if except_list: - raise Exception("select() failed") + raise Exception("select() failed on sockets {except_list}") if not read_list: - raise TimeoutError("") + raise TimeoutError("pipe did not receive data for {self.timeout} seconds") for r in read_list: other = self.dest if r is self.source else self.source