ignore socket.recv timeout in udp transport

This commit is contained in:
Jan Pochyla 2016-07-14 15:57:05 +02:00
parent 0f48e15c48
commit a129b072d3

View File

@ -2,7 +2,6 @@
import socket
from select import select
import time
from .transport import TransportV2, ConnectionError
class UdpTransport(TransportV2):
@ -40,7 +39,12 @@ class UdpTransport(TransportV2):
self.socket.sendall(chunk)
def _read_chunk(self):
data = self.socket.recv(64)
while True:
try:
data = self.socket.recv(64)
break
except socket.timeout:
continue
if len(data) != 64:
raise Exception("Unexpected chunk size: %d" % len(data))