Added Channel field to processPacket callback to retrieve attributes and manage connection

This commit is contained in:
Collin Smith
2020-06-25 12:18:44 -07:00
parent 597ae213c5
commit 8a38fd7139
7 changed files with 12 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import com.google.flatbuffers.FlatBufferBuilder;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
@ -92,7 +93,7 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor {
}
@Override
public void processPacket(ByteBuf bb) {
public void processPacket(Channel ch, ByteBuf bb) {
Gdx.app.debug(TAG, "Processing packet...");
Gdx.app.log(TAG, ByteBufUtil.hexDump(bb));
}

View File

@ -3,6 +3,7 @@ package com.riiablo.net.reliable;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
@ -80,7 +81,7 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor {
}
@Override
public void processPacket(ByteBuf bb) {
public void processPacket(Channel ch, ByteBuf bb) {
Gdx.app.debug(TAG, "Processing packet...");
Gdx.app.log(TAG, ByteBufUtil.hexDump(bb));

View File

@ -4,6 +4,7 @@ import com.google.flatbuffers.FlatBufferBuilder;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
@ -94,7 +95,7 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor {
}
@Override
public void processPacket(ByteBuf bb) {
public void processPacket(Channel ch, ByteBuf bb) {
Gdx.app.debug(TAG, "Processing packet...");
Gdx.app.log(TAG, ByteBufUtil.hexDump(bb));
}

View File

@ -3,6 +3,7 @@ package com.riiablo.net.tcp;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
@ -80,7 +81,7 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor {
}
@Override
public void processPacket(ByteBuf bb) {
public void processPacket(Channel ch, ByteBuf bb) {
Gdx.app.debug(TAG, "Processing packet...");
Gdx.app.log(TAG, " " + ByteBufUtil.hexDump(bb));
}