Ignore if socket is blocking

This commit is contained in:
clerie 2022-06-19 15:41:43 +02:00
parent 000a00fec8
commit 0df5286c0e
1 changed files with 5 additions and 2 deletions

View File

@ -55,8 +55,11 @@ class Connection:
if select.select([self._socket], [], []) != ([], [], []):
# wait for data availiable
while True:
# fill buffer with one message
data = self._socket.recv(1024)
try:
# fill buffer with one message
data = self._socket.recv(1024)
except BlockingIOError:
continue
if not data:
# buffer is empty