changeset 1257:a0e5df7b0e45

ParallelFlowWorker bugfix
author Devel 2
date Thu, 02 Jul 2020 10:50:38 +0200
parents a9eb4c208539
children d4c82942a0e7
files stress-tester/src/main/java/com/passus/st/client/ParallelFlowWorker.java
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/ParallelFlowWorker.java	Thu Jul 02 10:50:01 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/ParallelFlowWorker.java	Thu Jul 02 10:50:38 2020 +0200
@@ -250,7 +250,9 @@
                         SessionInfo sessionInfo = payloadEvent.getSessionInfo();
                         flowThread = register(sessionInfo);
                         if (flowThread != null) {
-                            flowThread.handle(SessionStatusEvent.establishedEvent(sessionInfo));
+                            SessionStatusEvent sessionStatusEvent = SessionStatusEvent.establishedEvent(sessionInfo);
+                            sessionStatusEvent.setTimestamp(payloadEvent.getTimestamp());
+                            flowThread.handle(sessionStatusEvent);
                         }
                     }
 
@@ -438,10 +440,10 @@
         private void finish() {
             flowProcessor.disconnect(flowContext, true);
             working = false;
-
         }
 
         private void sleep(Event event) {
+            System.out.println(event);
             if (sleepFactor != DEFAULT_SLEEP_FACTOR_NO_SLEEP) {
                 if (lastEventTimestamp != -1) {
                     long timeToSleep = (long) ((event.getTimestamp() - lastEventTimestamp) * sleepFactor);
@@ -471,12 +473,12 @@
                 }
 
                 if (event != null) {
-                    sleep(event);
                     if (trace) {
                         trace(logger, flowContext, "Event processing: {}", event);
                     }
 
                     if (event.getType() == SessionStatusEvent.TYPE) {
+                        sleep(event);
                         SessionStatusEvent statusEvent = (SessionStatusEvent) event;
                         if (statusEvent.getStatus() == SessionStatusEvent.STATUS_ESTABLISHED) {
                             flowProcessor.connect(flowContext, true);
@@ -484,6 +486,7 @@
                             finish();
                         }
                     } else if (event.getType() == SessionPayloadEvent.TYPE) {
+                        sleep(event);
                         if (flowContext.blocked) {
                             continue;
                         } else if (mayReconnect(flowContext)) {