1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-13 08:50:56 +00:00

python/udp: make socket timeout configurable

This commit is contained in:
matejcik 2019-10-18 13:32:10 +02:00
parent c970ad437d
commit 32074c7bff

View File

@ -20,6 +20,8 @@ from typing import Iterable, Optional, cast
from . import TransportException
from .protocol import ProtocolBasedTransport, get_protocol
SOCKET_TIMEOUT = 10
class UdpTransport(ProtocolBasedTransport):
@ -85,7 +87,7 @@ class UdpTransport(ProtocolBasedTransport):
def open(self) -> None:
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.socket.connect(self.device)
self.socket.settimeout(10)
self.socket.settimeout(SOCKET_TIMEOUT)
def close(self) -> None:
if self.socket is not None: