changeset 567:9b42aa39f460

PcapReporter - fixed bugs introduced in r541 r545
author Devel 1
date Tue, 26 Sep 2017 14:15:04 +0200
parents 11c45aa98eb1
children e573828e24e5
files stress-tester-reporter/src/main/java/com/passus/st/reporter/ReporterImpl.java stress-tester/src/main/java/com/passus/st/PcapReporter.java stress-tester/src/main/java/com/passus/st/client/http/ReporterWrapper.java
diffstat 3 files changed, 23 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester-reporter/src/main/java/com/passus/st/reporter/ReporterImpl.java	Fri Sep 22 14:15:27 2017 +0200
+++ b/stress-tester-reporter/src/main/java/com/passus/st/reporter/ReporterImpl.java	Tue Sep 26 14:15:04 2017 +0200
@@ -114,16 +114,16 @@
             // unused keys:
             // origClientIp origClientPort origServerIp origServerPort
             // respVersion
-            long reqStart = Long.parseLong(getValue(fields, "reqStart"));
-            long reqStop = Long.parseLong(getValue(fields, "reqStop"));
-            long respStart = Long.parseLong(getValue(fields, "respStart"));
-            long respStop = Long.parseLong(getValue(fields, "respStop"));
-            String url = getValue(fields, "url");
-            printDuration(reqStart, reqStop, "req", url);
-            printDuration(reqStop, respStart, "r2r", url);
-            printDuration(respStart, respStop, "res", url);
+            if (merge) {
+                long reqStart = Long.parseLong(getValue(fields, "reqStart"));
+                long reqStop = Long.parseLong(getValue(fields, "reqStop"));
+                long respStart = Long.parseLong(getValue(fields, "respStart"));
+                long respStop = Long.parseLong(getValue(fields, "respStop"));
+                String url = getValue(fields, "url");
+                printDuration(reqStart, reqStop, "req", url);
+                printDuration(reqStop, respStart, "r2r", url);
+                printDuration(respStart, respStop, "res", url);
 
-            if (merge) {
                 addValue(builder, getValue(fields, "reqId"));
                 addValue(builder, getValue(fields, "clientPort"));
                 addValue(builder, getValue(fields, "reqStart"));
--- a/stress-tester/src/main/java/com/passus/st/PcapReporter.java	Fri Sep 22 14:15:27 2017 +0200
+++ b/stress-tester/src/main/java/com/passus/st/PcapReporter.java	Tue Sep 26 14:15:04 2017 +0200
@@ -291,7 +291,7 @@
 
                         reporter.responseReceived(req, resp, ctx);
                     } catch (Exception e) {
-                        logger.debug(e);
+                        logger.debug(e.getMessage(), e);
                     }
                 }
             }
--- a/stress-tester/src/main/java/com/passus/st/client/http/ReporterWrapper.java	Fri Sep 22 14:15:27 2017 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/ReporterWrapper.java	Tue Sep 26 14:15:04 2017 +0200
@@ -77,15 +77,22 @@
         }
 
         SessionInfo session = context.sessionInfo();
-        SocketAddress localAddress = context.channelContext.getLocalAddress();
-        SocketAddress remoteAddress = context.channelContext.getRemoteAddress();
 
         HttpRequestResponseMetric metric = new HttpRequestResponseMetric();
 
-        metric.setClientIp(localAddress.getIp().toString());
-        metric.setClientPort(localAddress.getPort());
-        metric.setServerIp(remoteAddress.getIp().toString());
-        metric.setServerPort(remoteAddress.getPort());
+        if (context.channelContext != null) {
+            SocketAddress localAddress = context.channelContext.getLocalAddress();
+            SocketAddress remoteAddress = context.channelContext.getRemoteAddress();
+            metric.setClientIp(localAddress.getIp().toString());
+            metric.setClientPort(localAddress.getPort());
+            metric.setServerIp(remoteAddress.getIp().toString());
+            metric.setServerPort(remoteAddress.getPort());
+        } else {
+            metric.setClientIp(session.getSrcIp().toString());
+            metric.setClientPort(session.getSrcPort());
+            metric.setServerIp(session.getDstIp().toString());
+            metric.setServerPort(session.getDstPort());
+        }
         metric.setOrigClientIp(session.getSrcIp().toString());
         metric.setOrigClientPort(session.getSrcPort());
         metric.setOrigServerIp(session.getDstIp().toString());