mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-06 16:51:37 +00:00
Make server exit if it could not bind to a port.
This commit is contained in:
+11
-10
@@ -107,18 +107,19 @@ public final class Server {
|
|||||||
* @param jagGrabAddress The JAGGRAB address to bind to.
|
* @param jagGrabAddress The JAGGRAB address to bind to.
|
||||||
*/
|
*/
|
||||||
public void bind(SocketAddress serviceAddress, SocketAddress httpAddress, SocketAddress jagGrabAddress) {
|
public void bind(SocketAddress serviceAddress, SocketAddress httpAddress, SocketAddress jagGrabAddress) {
|
||||||
logger.fine("Binding service listener to address: " + serviceAddress + "...");
|
|
||||||
serviceBootstrap.bind(serviceAddress);
|
|
||||||
|
|
||||||
logger.fine("Binding HTTP listener to address: " + httpAddress + "...");
|
|
||||||
try {
|
try {
|
||||||
httpBootstrap.bind(httpAddress);
|
logger.fine("Binding service listener to address: " + serviceAddress + "...");
|
||||||
} catch (Throwable t) {
|
serviceBootstrap.bind(serviceAddress).sync();
|
||||||
logger.log(Level.WARNING, "Binding to HTTP failed: client will use JAGGRAB as a fallback (not recommended)!", t);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.fine("Binding JAGGRAB listener to address: " + jagGrabAddress + "...");
|
logger.fine("Binding HTTP listener to address: " + httpAddress + "...");
|
||||||
jagGrabBootstrap.bind(jagGrabAddress);
|
httpBootstrap.bind(httpAddress).sync();
|
||||||
|
|
||||||
|
logger.fine("Binding JAGGRAB listener to address: " + jagGrabAddress + "...");
|
||||||
|
jagGrabBootstrap.bind(jagGrabAddress).sync();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.log(Level.SEVERE, "Binding to a port failed: ensure apollo isn't already running.", e);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
logger.info("Ready for connections.");
|
logger.info("Ready for connections.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user