Skip to content

Commit

Permalink
[Hot fix]Fix bugs for port check (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
TangJiakai authored Aug 7, 2024
1 parent ab46935 commit af8e45d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/agentscope/utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ def check_port(port: Optional[int] = None) -> int:
return new_port
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
try:
code = s.connect_ex(("localhost", port))
if code != 0:
if s.connect_ex(("localhost", port)) == 0:
raise RuntimeError("Port is occupied.")
except Exception:
new_port = find_available_port()
Expand Down

0 comments on commit af8e45d

Please sign in to comment.