diff options
Diffstat (limited to 'src/main/java/org/traccar/protocol/TaipProtocol.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/TaipProtocol.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/TaipProtocol.java b/src/main/java/org/traccar/protocol/TaipProtocol.java index 71ab485ca..f57bb296c 100644 --- a/src/main/java/org/traccar/protocol/TaipProtocol.java +++ b/src/main/java/org/traccar/protocol/TaipProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2023 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import org.traccar.TrackerServer; import org.traccar.config.Config; import jakarta.inject.Inject; +import org.traccar.config.Keys; public class TaipProtocol extends BaseProtocol { @@ -33,7 +34,9 @@ public class TaipProtocol extends BaseProtocol { @Override protected void addProtocolHandlers(PipelineBuilder pipeline, Config config) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '<')); - pipeline.addLast(new TaipPrefixEncoder(TaipProtocol.this)); + if (config.getBoolean(Keys.PROTOCOL_PREFIX.withPrefix(getName()))) { + pipeline.addLast(new TaipPrefixEncoder()); + } pipeline.addLast(new StringDecoder()); pipeline.addLast(new StringEncoder()); pipeline.addLast(new TaipProtocolDecoder(TaipProtocol.this)); @@ -42,7 +45,9 @@ public class TaipProtocol extends BaseProtocol { addServer(new TrackerServer(config, getName(), true) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline, Config config) { - pipeline.addLast(new TaipPrefixEncoder(TaipProtocol.this)); + if (config.getBoolean(Keys.PROTOCOL_PREFIX.withPrefix(getName()))) { + pipeline.addLast(new TaipPrefixEncoder()); + } pipeline.addLast(new StringDecoder()); pipeline.addLast(new StringEncoder()); pipeline.addLast(new TaipProtocolDecoder(TaipProtocol.this)); |