Warn if can't attach to websocket port
This commit is contained in:
parent
ef2e393ac8
commit
46a83324ab
1 changed files with 17 additions and 9 deletions
|
|
@ -9,6 +9,7 @@ require "lib/diaspora/websocket"
|
||||||
EM.next_tick {
|
EM.next_tick {
|
||||||
Diaspora::WebSocket.initialize_channels
|
Diaspora::WebSocket.initialize_channels
|
||||||
|
|
||||||
|
begin
|
||||||
EventMachine::WebSocket.start(
|
EventMachine::WebSocket.start(
|
||||||
:host => "0.0.0.0",
|
:host => "0.0.0.0",
|
||||||
:port => APP_CONFIG[:socket_port],
|
:port => APP_CONFIG[:socket_port],
|
||||||
|
|
@ -22,5 +23,12 @@ require "lib/diaspora/websocket"
|
||||||
ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) }
|
ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
rescue RuntimeError => e
|
||||||
|
if e.message =~ /no acceptor/
|
||||||
|
raise RuntimeError, "Could not listen on port #{APP_CONFIG[:socket_port]}, perhaps another process is already using it?"
|
||||||
|
else
|
||||||
|
raise
|
||||||
|
end
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue