mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-19 16:57:20 +07:00
Modified API slightly to improve extension
This commit is contained in:
parent
2f066cbd0f
commit
725bbe4a01
@ -1,8 +1,10 @@
|
||||
package com.riiablo.net;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public interface PacketSender<T> {
|
||||
Channel channel();
|
||||
void sendMessage(ByteBuffer bb);
|
||||
void sendMessage(T qos, ByteBuffer bb);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.riiablo.net.reliable;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.socket.DatagramChannel;
|
||||
import io.netty.channel.socket.DatagramPacket;
|
||||
@ -51,8 +52,9 @@ public class ReliableEndpoint implements PacketSender<QoS>, MessageChannel.Packe
|
||||
return channel.remoteAddress();
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return channel.isConnected();
|
||||
@Override
|
||||
public Channel channel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
|
@ -88,9 +88,7 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor {
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
if (endpoint != null && endpoint.isConnected()) {
|
||||
endpoint.update(Gdx.graphics.getDeltaTime());
|
||||
}
|
||||
endpoint.update(Gdx.graphics.getDeltaTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,9 +68,7 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor {
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
if (endpoint != null && endpoint.isConnected()) {
|
||||
endpoint.update(Gdx.graphics.getDeltaTime());
|
||||
}
|
||||
endpoint.update(Gdx.graphics.getDeltaTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user