Restart server on general settings change (#1137)

This commit is contained in:
Matt
2024-01-08 13:02:31 -05:00
committed by GitHub
parent 02df8aa925
commit 6444ae884d
5 changed files with 63 additions and 6 deletions

View File

@@ -82,9 +82,14 @@ public class DataSocketHandler {
protected void onClose(WsCloseContext context) {
users.remove(context);
var remote = (InetSocketAddress) context.session.getRemoteAddress();
var host = remote.getAddress().toString() + ":" + remote.getPort();
var reason = context.reason() != null ? context.reason() : "Connection closed by client";
logger.info("Closing websocket connection from " + host + " for reason: " + reason);
// Remote can be null if server is being closed for restart
if (remote != null) {
var host = remote.getAddress().toString() + ":" + remote.getPort();
var reason = context.reason() != null ? context.reason() : "Connection closed by client";
logger.info("Closing websocket connection from " + host + " for reason: " + reason);
} else {
logger.info("Closing websockets for user " + context.getSessionId());
}
}
@SuppressWarnings({"unchecked"})