From 58a576dfc93f7a332f2c5cb0b2061983043da817 Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Wed, 24 Jun 2020 01:06:39 -0700 Subject: [PATCH] TestClient and TestServer now call ReliableEndpoint#update(float) every frame --- .../src/com/riiablo/net/reliable/ReliableEndpoint.java | 4 ++++ server/netty/src/com/riiablo/net/reliable/TestClient.java | 7 +++++++ server/netty/src/com/riiablo/net/reliable/TestServer.java | 7 +++++++ 3 files changed, 18 insertions(+) diff --git a/server/netty/src/com/riiablo/net/reliable/ReliableEndpoint.java b/server/netty/src/com/riiablo/net/reliable/ReliableEndpoint.java index 612414c2..4e862102 100644 --- a/server/netty/src/com/riiablo/net/reliable/ReliableEndpoint.java +++ b/server/netty/src/com/riiablo/net/reliable/ReliableEndpoint.java @@ -49,6 +49,10 @@ public class ReliableEndpoint implements MessageChannel.PacketTransceiver { return channel.remoteAddress(); } + public boolean isConnected() { + return channel.isConnected(); + } + public void reset() { for (MessageChannel mc : channels) if (mc != null) mc.reset(); } diff --git a/server/netty/src/com/riiablo/net/reliable/TestClient.java b/server/netty/src/com/riiablo/net/reliable/TestClient.java index 8d48dc2d..d99604c5 100644 --- a/server/netty/src/com/riiablo/net/reliable/TestClient.java +++ b/server/netty/src/com/riiablo/net/reliable/TestClient.java @@ -85,6 +85,13 @@ public class TestClient extends ApplicationAdapter implements ReliableEndpoint.P } } + @Override + public void render() { + if (endpoint != null && endpoint.isConnected()) { + endpoint.update(Gdx.graphics.getDeltaTime()); + } + } + @Override public void processPacket(ByteBuf bb) { Gdx.app.debug(TAG, "Processing packet..."); diff --git a/server/netty/src/com/riiablo/net/reliable/TestServer.java b/server/netty/src/com/riiablo/net/reliable/TestServer.java index 5546e161..5e44b626 100644 --- a/server/netty/src/com/riiablo/net/reliable/TestServer.java +++ b/server/netty/src/com/riiablo/net/reliable/TestServer.java @@ -65,6 +65,13 @@ public class TestServer extends ApplicationAdapter implements ReliableEndpoint.P } } + @Override + public void render() { + if (endpoint != null && endpoint.isConnected()) { + endpoint.update(Gdx.graphics.getDeltaTime()); + } + } + @Override public void processPacket(ByteBuf bb) { Gdx.app.debug(TAG, "Processing packet...");