This commit is contained in:
Gravita 2022-01-07 17:33:41 +07:00
parent 9d1118ea97
commit f7c8d03131

View file

@ -30,6 +30,10 @@ public void invoke(String... args) {
WebSocketService service = server.nettyServerSocketHandler.nettyServer.service; WebSocketService service = server.nettyServerSocketHandler.nettyServer.service;
service.channels.forEach((channel -> { service.channels.forEach((channel -> {
WebSocketFrameHandler frameHandler = channel.pipeline().get(WebSocketFrameHandler.class); WebSocketFrameHandler frameHandler = channel.pipeline().get(WebSocketFrameHandler.class);
if(frameHandler == null) {
LogHelper.info("Channel %s", IOHelper.getIP(channel.remoteAddress()));
return;
}
Client client = frameHandler.getClient(); Client client = frameHandler.getClient();
String ip = frameHandler.context.ip != null ? frameHandler.context.ip : IOHelper.getIP(channel.remoteAddress()); String ip = frameHandler.context.ip != null ? frameHandler.context.ip : IOHelper.getIP(channel.remoteAddress());
if (!client.isAuth) if (!client.isAuth)