projects
/
music-assistant-server.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a937f7b
)
Fix for port already in use check (#373)
author
Marcel van der Veldt
<m.vanderveldt@outlook.com>
Fri, 17 Jun 2022 11:43:50 +0000
(13:43 +0200)
committer
GitHub
<noreply@github.com>
Fri, 17 Jun 2022 11:43:50 +0000
(13:43 +0200)
music_assistant/helpers/util.py
patch
|
blob
|
history
diff --git
a/music_assistant/helpers/util.py
b/music_assistant/helpers/util.py
index e190432f216433cae439a717e3d46fc4a7d15f31..e76bb82e9eb2076bb39fc36fc132b57cdeeda493 100755
(executable)
--- a/
music_assistant/helpers/util.py
+++ b/
music_assistant/helpers/util.py
@@
-163,7
+163,10
@@
def get_ip():
def is_port_in_use(port: int) -> bool:
"""Check if port is in use."""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as _sock:
- return _sock.connect_ex(("localhost", port)) == 0
+ try:
+ return _sock.connect_ex(("localhost", port)) == 0
+ except socket.gaierror:
+ return True
def select_stream_port() -> int: