aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/GenericPipelineFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/GenericPipelineFactory.java')
-rw-r--r--src/org/traccar/GenericPipelineFactory.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/org/traccar/GenericPipelineFactory.java b/src/org/traccar/GenericPipelineFactory.java
index c5e2cc812..d2012753e 100644
--- a/src/org/traccar/GenericPipelineFactory.java
+++ b/src/org/traccar/GenericPipelineFactory.java
@@ -19,6 +19,7 @@ import java.net.InetSocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.*;
import org.jboss.netty.handler.logging.LoggingHandler;
+import org.jboss.netty.handler.timeout.IdleStateHandler;
import org.traccar.geocode.ReverseGeocoder;
import org.traccar.helper.Log;
import org.traccar.model.DataManager;
@@ -31,6 +32,7 @@ public abstract class GenericPipelineFactory implements ChannelPipelineFactory {
private TrackerServer server;
private DataManager dataManager;
private Boolean loggerEnabled;
+ private Integer resetDelay;
private ReverseGeocoder geocoder;
/**
@@ -86,10 +88,11 @@ public abstract class GenericPipelineFactory implements ChannelPipelineFactory {
}
public GenericPipelineFactory(
- TrackerServer server, DataManager dataManager, Boolean loggerEnabled, ReverseGeocoder geocoder) {
+ TrackerServer server, DataManager dataManager, Boolean loggerEnabled, Integer resetDelay, ReverseGeocoder geocoder) {
this.server = server;
this.dataManager = dataManager;
this.loggerEnabled = loggerEnabled;
+ this.resetDelay = resetDelay;
this.geocoder = geocoder;
}
@@ -101,6 +104,9 @@ public abstract class GenericPipelineFactory implements ChannelPipelineFactory {
public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = Channels.pipeline();
+ if (resetDelay != 0) {
+ pipeline.addLast("idleHandler", new IdleStateHandler(GlobalTimer.getTimer(), resetDelay, 0, 0));
+ }
pipeline.addLast("openHandler", new OpenChannelHandler(server));
if (loggerEnabled) {
pipeline.addLast("logger", new StandardLoggingHandler());