mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-18 10:32:53 +00:00
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
|
||||
proc isPortBusy*(port: Port): bool =
|
||||
var sock: Socket
|
||||
result = false
|
||||
let socket = newSocket()
|
||||
defer: socket.close()
|
||||
|
||||
try:
|
||||
sock = newSocket()
|
||||
sock.setSockOpt(OptReuseAddr, true)
|
||||
sock.bindAddr(port)
|
||||
sock.close()
|
||||
return false
|
||||
socket.connect("localhost", port)
|
||||
result = true
|
||||
except OSError:
|
||||
return true
|
||||
result = false
|
Loading…
x
Reference in New Issue
Block a user