Skip to content

Commit

Permalink
Custom socket connect timeout in Session()
Browse files Browse the repository at this point in the history
  • Loading branch information
akhil-jha committed Apr 30, 2023
1 parent 33c9741 commit aa6296e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion broker/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def __init__(self, **kwargs):
sock.settimeout(kwargs.get("timeout"))
port = kwargs.get("port", 22)
key_filename = kwargs.get("key_filename")
helpers.simple_retry(sock.connect, [(host, port)])
socket_connect_timeout = kwargs.get("socket_connect_timeout", 60)
helpers.simple_retry(sock.connect, [(host, port)], max_timeout=socket_connect_timeout)
self.session = ssh2_Session()
self.session.handshake(sock)
if key_filename:
Expand Down

0 comments on commit aa6296e

Please sign in to comment.