changeset 949:48f0ecbbf6d8

PcapSessionEventSource refactorization
author Devel 2
date Tue, 14 May 2019 14:12:13 +0200
parents e98b80c2ae6a
children a2be4422ceb5
files stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java	Tue May 14 08:13:52 2019 +0200
+++ b/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java	Tue May 14 14:12:13 2019 +0200
@@ -8,6 +8,7 @@
 import com.passus.config.Configuration;
 import com.passus.config.ConfigurationContext;
 import com.passus.config.annotations.NodeDefinitionCreate;
+import com.passus.config.schema.MapNodeDefinition;
 import com.passus.config.schema.NodeDefinition;
 import com.passus.config.schema.NodeDefinitionCreator;
 import com.passus.config.validation.LongValidator;
@@ -23,6 +24,7 @@
 import com.passus.net.session.SessionContext;
 import com.passus.net.session.SessionKey;
 import com.passus.net.session.TcpSessionProcessor;
+import com.passus.net.session.UdpSessionProcessor;
 import com.passus.net.source.pcap.FrameDecoderImpl;
 import com.passus.st.client.AbstractEvent;
 import com.passus.st.client.DataEvents.DataEnd;
@@ -49,7 +51,6 @@
 import java.util.concurrent.TimeUnit;
 
 import static com.passus.config.schema.ConfigurationSchemaBuilder.*;
-import com.passus.config.schema.MapNodeDefinition;
 import static com.passus.net.session.TcpSessionProcessorConstants.STATUS_CLOSE;
 import static com.passus.net.session.TcpSessionProcessorConstants.STATUS_ESTABLISHED;
 
@@ -449,7 +450,6 @@
                     }
                 }
             }
-
         }
 
     }
@@ -464,6 +464,8 @@
 
         private final TcpSessionProcessor tcpProc;
 
+        private final UdpSessionProcessor udpProc;
+
         private final HttpSessionAnalyzer httpAnalyzer;
 
         private final CustomTimeGenerator timeGenerator = new CustomTimeGenerator();
@@ -483,14 +485,17 @@
             httpAnalyzer = new HttpSessionAnalyzer();
             httpAnalyzer.getPortsRange().clear();
             httpAnalyzer.getPortsRange().addAll(portsRange);
-            httpAnalyzer.addListener(listener);
+            httpAnalyzer.setListener(listener);
 
             tcpProc.addAnalyzer(httpAnalyzer);
+
+            udpProc = new UdpSessionProcessor();
         }
 
         public void deactivate() {
             working = false;
             tcpProc.stop();
+            udpProc.stop();
             httpAnalyzer.stop();
         }
 
@@ -498,6 +503,7 @@
         public void run() {
             working = true;
             tcpProc.start();
+            udpProc.start();
             httpAnalyzer.start();
 
             long lastTime = 0;
@@ -582,7 +588,7 @@
         }
 
         @Override
-        public void onMessageReceived(HttpMessage message, SessionContext context, long timestamp) {
+        public void onMessageReceived(SessionContext context, HttpMessage message, long timestamp) {
             if (message.isRequest()) {
                 lastRequests.put(context.getKey(), (HttpRequest) message);
             } else {
@@ -592,7 +598,7 @@
         }
 
         @Override
-        public void onSessionStatusChanged(int status, SessionContext context, long timestamp) {
+        public void onSessionStatusChanged(SessionContext context, int status, long timestamp) {
             int sessionInfoStatus;
             if (status < STATUS_ESTABLISHED) {
                 sessionInfoStatus = SessionStatusEvent.STATUS_OPENING;