提交 b618b40e 编写于 作者: A Amos Kong 提交者: Cleber Rosa

network/utils: add description of parameter address

Signed-off-by: NAmos Kong <amos@scylladb.com>
上级 b5e6aabd
...@@ -26,6 +26,7 @@ def is_port_free(port, address): ...@@ -26,6 +26,7 @@ def is_port_free(port, address):
Return True if the given port is available for use. Return True if the given port is available for use.
:param port: Port number :param port: Port number
:param address: Socket address to bind or connect
""" """
try: try:
s = socket.socket() s = socket.socket()
...@@ -50,6 +51,7 @@ def find_free_port(start_port, end_port, address="localhost"): ...@@ -50,6 +51,7 @@ def find_free_port(start_port, end_port, address="localhost"):
:param start_port: First port that will be checked. :param start_port: First port that will be checked.
:param end_port: Port immediately after the last one that will be checked. :param end_port: Port immediately after the last one that will be checked.
:param address: Socket address to bind or connect
""" """
for i in range(start_port, end_port): for i in range(start_port, end_port):
if is_port_free(i, address): if is_port_free(i, address):
...@@ -64,6 +66,7 @@ def find_free_ports(start_port, end_port, count, address="localhost"): ...@@ -64,6 +66,7 @@ def find_free_ports(start_port, end_port, count, address="localhost"):
:param start_port: First port that will be checked. :param start_port: First port that will be checked.
:param end_port: Port immediately after the last one that will be checked. :param end_port: Port immediately after the last one that will be checked.
:param count: Initial number of ports known to be free in the range. :param count: Initial number of ports known to be free in the range.
:param address: Socket address to bind or connect
""" """
ports = [] ports = []
i = start_port i = start_port
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册