diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-03 11:46:55 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-03 11:46:55 +1200 |
commit | f0d1a5df7aecf1237609200d3ecb7cdd3d0abcab (patch) | |
tree | c82ad82bdb77e0e33340d6a020dc0912448f60d8 /src/org/traccar/ExtendedObjectDecoder.java | |
parent | 06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07 (diff) | |
download | trackermap-server-f0d1a5df7aecf1237609200d3ecb7cdd3d0abcab.tar.gz trackermap-server-f0d1a5df7aecf1237609200d3ecb7cdd3d0abcab.tar.bz2 trackermap-server-f0d1a5df7aecf1237609200d3ecb7cdd3d0abcab.zip |
Properly handle datagram channels
Diffstat (limited to 'src/org/traccar/ExtendedObjectDecoder.java')
-rw-r--r-- | src/org/traccar/ExtendedObjectDecoder.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/org/traccar/ExtendedObjectDecoder.java b/src/org/traccar/ExtendedObjectDecoder.java index 6a6a0fc4d..22a9c7262 100644 --- a/src/org/traccar/ExtendedObjectDecoder.java +++ b/src/org/traccar/ExtendedObjectDecoder.java @@ -43,14 +43,16 @@ public abstract class ExtendedObjectDecoder extends ChannelInboundHandlerAdapter } @Override - public void channelRead(ChannelHandlerContext ctx, Object originalMessage) throws Exception { - Object decodedMessage = decode(ctx.channel(), ctx.channel().remoteAddress(), originalMessage); - onMessageEvent(ctx.channel(), ctx.channel().remoteAddress(), originalMessage, decodedMessage); + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + NetworkMessage networkMessage = (NetworkMessage) msg; + Object originalMessage = networkMessage.getMessage(); + Object decodedMessage = decode(ctx.channel(), networkMessage.getRemoteAddress(), originalMessage); + onMessageEvent(ctx.channel(), networkMessage.getRemoteAddress(), originalMessage, decodedMessage); if (originalMessage == decodedMessage) { ctx.fireChannelRead(originalMessage); } else { if (decodedMessage == null) { - decodedMessage = handleEmptyMessage(ctx.channel(), ctx.channel().remoteAddress(), originalMessage); + decodedMessage = handleEmptyMessage(ctx.channel(), networkMessage.getRemoteAddress(), originalMessage); } if (decodedMessage != null) { if (decodedMessage instanceof Collection) { |