fix launching multiple instances of status desktop including on windows systems (#15533)
fixes #15493
This commit is contained in:
parent
38d155f590
commit
5db513980f
|
@ -2,12 +2,12 @@ import net
|
||||||
|
|
||||||
# Util function to test if a port is busy
|
# Util function to test if a port is busy
|
||||||
proc isPortBusy*(port: Port): bool =
|
proc isPortBusy*(port: Port): bool =
|
||||||
var sock: Socket
|
result = false
|
||||||
|
let socket = newSocket()
|
||||||
|
defer: socket.close()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sock = newSocket()
|
socket.connect("localhost", port)
|
||||||
sock.setSockOpt(OptReuseAddr, true)
|
result = true
|
||||||
sock.bindAddr(port)
|
|
||||||
sock.close()
|
|
||||||
return false
|
|
||||||
except OSError:
|
except OSError:
|
||||||
return true
|
result = false
|
Loading…
Reference in New Issue