Agent: Clarify exceptions in SocketsPipe._pipe()

This commit is contained in:
Kekoa Kaaikala 2022-09-06 19:16:49 +00:00
parent 76fe0be990
commit 813c5f9d3b
1 changed files with 2 additions and 3 deletions

View File

@ -28,13 +28,12 @@ class SocketsPipe(Thread):
def _pipe(self): def _pipe(self):
sockets = [self.source, self.dest] sockets = [self.source, self.dest]
while True: while True:
# TODO: Figure out how to capture when the socket times out.
read_list, _, except_list = select.select(sockets, [], sockets, self.timeout) read_list, _, except_list = select.select(sockets, [], sockets, self.timeout)
if except_list: if except_list:
raise Exception("select() failed") raise Exception("select() failed on sockets {except_list}")
if not read_list: if not read_list:
raise TimeoutError("") raise TimeoutError("pipe did not receive data for {self.timeout} seconds")
for r in read_list: for r in read_list:
other = self.dest if r is self.source else self.source other = self.dest if r is self.source else self.source