aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/TrackerServer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/TrackerServer.java')
-rw-r--r--src/main/java/org/traccar/TrackerServer.java11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/TrackerServer.java b/src/main/java/org/traccar/TrackerServer.java
index ccf3cd640..0e0837cfb 100644
--- a/src/main/java/org/traccar/TrackerServer.java
+++ b/src/main/java/org/traccar/TrackerServer.java
@@ -55,11 +55,7 @@ public abstract class TrackerServer implements TrackerConnector {
return secure;
}
- public TrackerServer(boolean datagram, String protocol) {
- this.datagram = datagram;
-
- Config config = Main.getInjector().getInstance(Config.class);
-
+ public TrackerServer(Config config, String protocol, boolean datagram) {
secure = config.getBoolean(Keys.PROTOCOL_SSL.withPrefix(protocol));
address = config.getString(Keys.PROTOCOL_ADDRESS.withPrefix(protocol));
port = config.getInteger(Keys.PROTOCOL_PORT.withPrefix(protocol));
@@ -83,20 +79,17 @@ public abstract class TrackerServer implements TrackerConnector {
}
};
+ this.datagram = datagram;
if (datagram) {
-
bootstrap = new Bootstrap()
.group(EventLoopGroupFactory.getWorkerGroup())
.channel(NioDatagramChannel.class)
.handler(pipelineFactory);
-
} else {
-
bootstrap = new ServerBootstrap()
.group(EventLoopGroupFactory.getBossGroup(), EventLoopGroupFactory.getWorkerGroup())
.channel(NioServerSocketChannel.class)
.childHandler(pipelineFactory);
-
}
}