mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-13 17:00:59 +00:00
python/udp: make socket timeout configurable
This commit is contained in:
parent
c970ad437d
commit
32074c7bff
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user