Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

wait_server_available method ... #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions vibora/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,12 @@ def wait_server_available(host: str, port: int, timeout: int=10) -> None:
:param port: TCP port used to connect.
:return:
"""
sock = socket.socket()
sock.settimeout(timeout)
while timeout > 0:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sockwill be undefined, if arg timeoutis less than 0 when func is calling.

""" Start of change """
sock = socket.socket()
sock.settimeout(timeout)
""" End of change """

start_time = time.time()
try:
sock.connect((host, port))
Expand Down