mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-04-07 15:43:49 +00:00
Fix "address already in use" on server restart (Linux/macOS)
This commit is contained in:
parent
422f42ca7f
commit
d78fc46114
2 changed files with 25 additions and 2 deletions
|
|
@ -373,6 +373,7 @@ class LlamaServer:
|
|||
"""Check if a port is available for use."""
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
try:
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
s.bind(('', port))
|
||||
return True
|
||||
except OSError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue