From 919281e81499c813e2906ffa68fa3d4b31ffe8df Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Wed, 24 Jun 2020 11:35:45 -0700 Subject: [PATCH] Refactored PacketProcessor to com.riiablo.net --- server/netty/src/com/riiablo/net/PacketProcessor.java | 7 +++++++ .../src/com/riiablo/net/reliable/ReliableEndpoint.java | 5 +---- server/netty/src/com/riiablo/net/reliable/TestClient.java | 3 ++- server/netty/src/com/riiablo/net/reliable/TestServer.java | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 server/netty/src/com/riiablo/net/PacketProcessor.java diff --git a/server/netty/src/com/riiablo/net/PacketProcessor.java b/server/netty/src/com/riiablo/net/PacketProcessor.java new file mode 100644 index 00000000..ae66a060 --- /dev/null +++ b/server/netty/src/com/riiablo/net/PacketProcessor.java @@ -0,0 +1,7 @@ +package com.riiablo.net; + +import io.netty.buffer.ByteBuf; + +public interface PacketProcessor { + void processPacket(ByteBuf bb); +} diff --git a/server/netty/src/com/riiablo/net/reliable/ReliableEndpoint.java b/server/netty/src/com/riiablo/net/reliable/ReliableEndpoint.java index 4e862102..4587720f 100644 --- a/server/netty/src/com/riiablo/net/reliable/ReliableEndpoint.java +++ b/server/netty/src/com/riiablo/net/reliable/ReliableEndpoint.java @@ -9,6 +9,7 @@ import java.net.InetSocketAddress; import java.nio.ByteBuffer; import org.apache.commons.lang3.Validate; +import com.riiablo.net.PacketProcessor; import com.riiablo.net.reliable.channel.ReliableMessageChannel; import com.riiablo.net.reliable.channel.UnreliableMessageChannel; import com.riiablo.net.reliable.channel.UnreliableOrderedMessageChannel; @@ -104,10 +105,6 @@ public class ReliableEndpoint implements MessageChannel.PacketTransceiver { packetProcessor.processPacket(bb); } - public interface PacketProcessor { - void processPacket(ByteBuf bb); - } - public static final Stats stats = new Stats(); public static class Stats { diff --git a/server/netty/src/com/riiablo/net/reliable/TestClient.java b/server/netty/src/com/riiablo/net/reliable/TestClient.java index d99604c5..1a546cdc 100644 --- a/server/netty/src/com/riiablo/net/reliable/TestClient.java +++ b/server/netty/src/com/riiablo/net/reliable/TestClient.java @@ -21,11 +21,12 @@ import com.badlogic.gdx.backends.headless.HeadlessApplication; import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration; import com.riiablo.codec.Animation; +import com.riiablo.net.PacketProcessor; import com.riiablo.net.packet.netty.Connection; import com.riiablo.net.packet.netty.Netty; import com.riiablo.net.packet.netty.NettyData; -public class TestClient extends ApplicationAdapter implements ReliableEndpoint.PacketProcessor { +public class TestClient extends ApplicationAdapter implements PacketProcessor { private static final String TAG = "Client"; public static void main(String[] args) throws Exception { diff --git a/server/netty/src/com/riiablo/net/reliable/TestServer.java b/server/netty/src/com/riiablo/net/reliable/TestServer.java index 5e44b626..2516413d 100644 --- a/server/netty/src/com/riiablo/net/reliable/TestServer.java +++ b/server/netty/src/com/riiablo/net/reliable/TestServer.java @@ -19,10 +19,11 @@ import com.badlogic.gdx.backends.headless.HeadlessApplication; import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration; import com.riiablo.codec.Animation; +import com.riiablo.net.PacketProcessor; import com.riiablo.net.packet.netty.Netty; import com.riiablo.net.packet.netty.NettyData; -public class TestServer extends ApplicationAdapter implements ReliableEndpoint.PacketProcessor { +public class TestServer extends ApplicationAdapter implements PacketProcessor { private static final String TAG = "Server"; static final int PORT = 6114;