Add info on registered channels to /bungee to enable users to help identify cause of random timeouts & resource leaks
This commit is contained in:
parent
40768c1711
commit
b3c34815b0
@ -4,6 +4,7 @@ import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.netty.HandlerBoss;
|
||||
|
||||
public class CommandBungee extends Command
|
||||
{
|
||||
@ -17,5 +18,6 @@ public class CommandBungee extends Command
|
||||
public void execute(CommandSender sender, String[] args)
|
||||
{
|
||||
sender.sendMessage( ChatColor.BLUE + "This server is running BungeeCord version " + ProxyServer.getInstance().getVersion() + " by md_5" );
|
||||
sender.sendMessage( ChatColor.BLUE + "There are currently " + HandlerBoss.registeredChannels + " channels registered" );
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import net.md_5.bungee.packet.PacketHandler;
|
||||
public class HandlerBoss extends ChannelInboundMessageHandlerAdapter<byte[]>
|
||||
{
|
||||
|
||||
public static volatile int registeredChannels;
|
||||
private PacketHandler handler;
|
||||
|
||||
public void setHandler(PacketHandler handler)
|
||||
@ -27,6 +28,18 @@ public class HandlerBoss extends ChannelInboundMessageHandlerAdapter<byte[]>
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRegistered(ChannelHandlerContext ctx) throws Exception
|
||||
{
|
||||
registeredChannels++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception
|
||||
{
|
||||
registeredChannels--;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user