1
0

trezor: use lower device-enumeration timeout for udp transport

This transport IIUC is only used for the trezor emulator.
The default timeout is 10 seconds. Every time we enumerate hw devices,
we also enumerate trezor devices, including scanning for the udp transport.
For some reason, recently on Windows, sporadically, this scan keeps
hitting the timeout for me. Quite annoying, as I might not even be testing
trezor (and I am certainly not testing using the trezor emulator on Windows...),
but scanning to test other plugins.

Probably overkill to have a 10 sec timeout for contacting localhost anyway.
This commit is contained in:
SomberNight
2022-11-09 17:46:18 +00:00
parent 65a2529480
commit e4a880e435

View File

@@ -160,6 +160,11 @@ class TrezorPlugin(HW_PluginBase):
@runs_in_hwd_thread
def enumerate(self):
# Set lower timeout for UDP enumeration (used for emulator).
# The default of 10 sec is very long, and I often hit it for some reason on Windows (no emu running),
# blocking the whole enumeration.
from trezorlib.transport.udp import UdpTransport
trezorlib.transport.udp.SOCKET_TIMEOUT = 1
# If there is a bridge, prefer that.
# On Windows, the bridge runs as Admin (and Electrum usually does not),
# so the bridge has better chances of finding devices. see #5420