diff options
author | Anton Tananaev <anton@traccar.org> | 2023-03-21 13:40:50 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-03-21 13:40:58 -0700 |
commit | 2a0b2dee5eecd55f86c51fe2a25f7ac7484d6bde (patch) | |
tree | d0f187702e2b665b008de55e2467c6133d8ff17f /src/main/java/org/traccar/BasePipelineFactory.java | |
parent | 376df800e0f96b5237640420f7323a5980c0852b (diff) | |
download | trackermap-server-2a0b2dee5eecd55f86c51fe2a25f7ac7484d6bde.tar.gz trackermap-server-2a0b2dee5eecd55f86c51fe2a25f7ac7484d6bde.tar.bz2 trackermap-server-2a0b2dee5eecd55f86c51fe2a25f7ac7484d6bde.zip |
Response after position processed
Diffstat (limited to 'src/main/java/org/traccar/BasePipelineFactory.java')
-rw-r--r-- | src/main/java/org/traccar/BasePipelineFactory.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/BasePipelineFactory.java b/src/main/java/org/traccar/BasePipelineFactory.java index b184da45c..70f999c72 100644 --- a/src/main/java/org/traccar/BasePipelineFactory.java +++ b/src/main/java/org/traccar/BasePipelineFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2022 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 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. @@ -25,6 +25,7 @@ import io.netty.channel.ChannelPipeline; import io.netty.handler.timeout.IdleStateHandler; import org.traccar.config.Config; import org.traccar.config.Keys; +import org.traccar.handler.AcknowledgementHandler; import org.traccar.handler.ComputedAttributesHandler; import org.traccar.handler.CopyAttributesHandler; import org.traccar.handler.DefaultDataHandler; @@ -60,15 +61,19 @@ public abstract class BasePipelineFactory extends ChannelInitializer<Channel> { private final Injector injector; private final TrackerConnector connector; private final String protocol; - private int timeout; + private final boolean instantAcknowledgement; + private final int timeout; public BasePipelineFactory(TrackerConnector connector, Config config, String protocol) { this.injector = Main.getInjector(); this.connector = connector; this.protocol = protocol; - timeout = config.getInteger(Keys.PROTOCOL_TIMEOUT.withPrefix(protocol)); + instantAcknowledgement = config.getBoolean(Keys.SERVER_INSTANT_ACKNOWLEDGEMENT); + int timeout = config.getInteger(Keys.PROTOCOL_TIMEOUT.withPrefix(protocol)); if (timeout == 0) { - timeout = config.getInteger(Keys.SERVER_TIMEOUT); + this.timeout = config.getInteger(Keys.SERVER_TIMEOUT); + } else { + this.timeout = timeout; } } @@ -112,6 +117,9 @@ public abstract class BasePipelineFactory extends ChannelInitializer<Channel> { pipeline.addLast(new OpenChannelHandler(connector)); pipeline.addLast(new NetworkMessageHandler()); pipeline.addLast(new StandardLoggingHandler(protocol)); + if (!instantAcknowledgement) { + pipeline.addLast(new AcknowledgementHandler()); + } addProtocolHandlers(handler -> { if (handler instanceof BaseProtocolDecoder || handler instanceof BaseProtocolEncoder) { |