From 2d366f0ab3d88c635bec0f1f498396cd47557f1d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 30 Mar 2024 19:41:51 -0700 Subject: Fix remote address handler --- src/main/java/org/traccar/BasePipelineFactory.java | 2 +- src/main/java/org/traccar/handler/network/RemoteAddressHandler.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/traccar/BasePipelineFactory.java b/src/main/java/org/traccar/BasePipelineFactory.java index 6d9431ad6..40360cca7 100644 --- a/src/main/java/org/traccar/BasePipelineFactory.java +++ b/src/main/java/org/traccar/BasePipelineFactory.java @@ -96,7 +96,6 @@ public abstract class BasePipelineFactory extends ChannelInitializer { pipeline.addLast(injectMembers(new NetworkForwarderHandler(port))); } pipeline.addLast(new NetworkMessageHandler()); - pipeline.addLast(new RemoteAddressHandler(config)); pipeline.addLast(injectMembers(new StandardLoggingHandler(protocol))); if (!connector.isDatagram() && !config.getBoolean(Keys.SERVER_INSTANT_ACKNOWLEDGEMENT)) { @@ -116,6 +115,7 @@ public abstract class BasePipelineFactory extends ChannelInitializer { pipeline.addLast(handler); }); + pipeline.addLast(injector.getInstance(RemoteAddressHandler.class)); pipeline.addLast(injector.getInstance(ProcessingHandler.class)); pipeline.addLast(injector.getInstance(MainEventHandler.class)); } diff --git a/src/main/java/org/traccar/handler/network/RemoteAddressHandler.java b/src/main/java/org/traccar/handler/network/RemoteAddressHandler.java index d545ed799..c52bb2be1 100644 --- a/src/main/java/org/traccar/handler/network/RemoteAddressHandler.java +++ b/src/main/java/org/traccar/handler/network/RemoteAddressHandler.java @@ -19,12 +19,14 @@ import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import jakarta.inject.Inject; +import jakarta.inject.Singleton; import org.traccar.config.Config; import org.traccar.config.Keys; import org.traccar.model.Position; import java.net.InetSocketAddress; +@Singleton @ChannelHandler.Sharable public class RemoteAddressHandler extends ChannelInboundHandlerAdapter { -- cgit v1.2.3