1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 01:48:17 +00:00

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 import socket
from select import select from select import select
import time
from .transport import TransportV2, ConnectionError from .transport import TransportV2, ConnectionError
class UdpTransport(TransportV2): class UdpTransport(TransportV2):
@ -40,7 +39,12 @@ class UdpTransport(TransportV2):
self.socket.sendall(chunk) self.socket.sendall(chunk)
def _read_chunk(self): 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: if len(data) != 64:
raise Exception("Unexpected chunk size: %d" % len(data)) raise Exception("Unexpected chunk size: %d" % len(data))