TestClient and TestServer now call ReliableEndpoint#update(float) every frame

This commit is contained in:
Collin Smith 2020-06-24 01:06:39 -07:00
parent 165459dd12
commit 58a576dfc9
3 changed files with 18 additions and 0 deletions

View File

@ -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();
}

View File

@ -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...");

View File

@ -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...");