aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-10-20 17:35:35 -0700
committerAnton Tananaev <anton@traccar.org>2023-10-20 17:35:35 -0700
commitb7145ea2e9d7efabb0d9806e76e7ac2995e56b27 (patch)
tree0e58df9f4f092df661ae7d868e19c239b7071fbc /src
parenta08bc10a8fd15a6b0fa4c04607eeae325e0c5407 (diff)
downloadtrackermap-server-b7145ea2e9d7efabb0d9806e76e7ac2995e56b27.tar.gz
trackermap-server-b7145ea2e9d7efabb0d9806e76e7ac2995e56b27.tar.bz2
trackermap-server-b7145ea2e9d7efabb0d9806e76e7ac2995e56b27.zip
Fix DSM response handling
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java11
-rw-r--r--src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java3
2 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java
index 5a6425e7e..f6712d7f2 100644
--- a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java
@@ -138,10 +138,13 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder {
break;
case MSG_PATH_RESPONSE:
String file = buf.readCharSequence(buf.readUnsignedShort(), StandardCharsets.US_ASCII).toString();
- ByteBuf response = Unpooled.buffer();
- response.writeShort(MSG_FILE_REQUEST);
- response.writeShort(file.length());
- response.writeCharSequence(file, StandardCharsets.US_ASCII);
+ if (channel != null) {
+ ByteBuf response = Unpooled.buffer();
+ response.writeShort(MSG_FILE_REQUEST);
+ response.writeShort(file.length());
+ response.writeCharSequence(file, StandardCharsets.US_ASCII);
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
+ }
break;
default:
break;
diff --git a/src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java
index de70e2b63..e1c31fc47 100644
--- a/src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java
@@ -14,6 +14,9 @@ public class DualcamProtocolDecoderTest extends ProtocolTest {
"000000050001403a4abaa31444000400"));
verifyNull(decoder, binary(
+ "000d001e64736d2f706963747572652f3233313032302f3233313435322e6a706700"));
+
+ verifyNull(decoder, binary(
"00010006000000110000"));
verifyNull(decoder, binary(