mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-11 15:40:54 +00:00
Set default-negotiate-timeout = 5 sec
This commit is contained in:
@ -16,7 +16,7 @@ from .exceptions import (
|
|||||||
|
|
||||||
MULTISELECT_PROTOCOL_ID = "/multistream/1.0.0"
|
MULTISELECT_PROTOCOL_ID = "/multistream/1.0.0"
|
||||||
PROTOCOL_NOT_FOUND_MSG = "na"
|
PROTOCOL_NOT_FOUND_MSG = "na"
|
||||||
DEFAULT_NEGOTIATE_TIMEOUT = 60
|
DEFAULT_NEGOTIATE_TIMEOUT = 5
|
||||||
|
|
||||||
|
|
||||||
class Multiselect(IMultiselectMuxer):
|
class Multiselect(IMultiselectMuxer):
|
||||||
@ -63,7 +63,10 @@ class Multiselect(IMultiselectMuxer):
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
command = await communicator.read()
|
with trio.fail_after(DEFAULT_NEGOTIATE_TIMEOUT):
|
||||||
|
command = await communicator.read()
|
||||||
|
except trio.TooSlowError:
|
||||||
|
raise MultiselectError("handshake read timeout")
|
||||||
except MultiselectCommunicatorError as error:
|
except MultiselectCommunicatorError as error:
|
||||||
raise MultiselectError() from error
|
raise MultiselectError() from error
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ from .exceptions import (
|
|||||||
|
|
||||||
MULTISELECT_PROTOCOL_ID = "/multistream/1.0.0"
|
MULTISELECT_PROTOCOL_ID = "/multistream/1.0.0"
|
||||||
PROTOCOL_NOT_FOUND_MSG = "na"
|
PROTOCOL_NOT_FOUND_MSG = "na"
|
||||||
DEFAULT_NEGOTIATE_TIMEOUT = 60
|
DEFAULT_NEGOTIATE_TIMEOUT = 5
|
||||||
|
|
||||||
|
|
||||||
class MultiselectClient(IMultiselectClient):
|
class MultiselectClient(IMultiselectClient):
|
||||||
|
|||||||
Reference in New Issue
Block a user