Skip to content

Commit

Permalink
Add trace logging to RakServerChannel when closing
Browse files Browse the repository at this point in the history
  • Loading branch information
SupremeMortal committed Jul 24, 2024
1 parent b7fdbfb commit 7e85ea3
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import io.netty.channel.socket.DatagramChannel;
import io.netty.util.concurrent.GenericFutureListener;
import io.netty.util.concurrent.PromiseCombiner;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import org.cloudburstmc.netty.channel.proxy.ProxyChannel;
import org.cloudburstmc.netty.channel.raknet.config.DefaultRakServerConfig;
import org.cloudburstmc.netty.channel.raknet.config.RakServerChannelConfig;
Expand All @@ -42,6 +44,8 @@

public class RakServerChannel extends ProxyChannel<DatagramChannel> implements ServerChannel {

private static final InternalLogger log = InternalLoggerFactory.getInstance(RakServerChannel.class);

private final RakServerChannelConfig config;
private final Map<SocketAddress, RakChildChannel> childChannelMap = new ConcurrentHashMap<>();
private final Consumer<RakChannel> childConsumer;
Expand Down Expand Up @@ -115,6 +119,9 @@ private void onChildClosed(ChannelFuture channelFuture) {

@Override
public void onCloseTriggered(ChannelPromise promise) {
if (log.isTraceEnabled()) {
log.trace("Closing RakServerChannel: {}", Thread.currentThread().getName(), new Throwable());
}
PromiseCombiner combiner = new PromiseCombiner(this.eventLoop());
this.childChannelMap.values().forEach(channel -> combiner.add(channel.close()));

Expand Down

0 comments on commit 7e85ea3

Please sign in to comment.