changeset 837:0910a8d32fd6

PcapReporter bugfix
author Devel 2
date Mon, 22 Jan 2018 11:40:54 +0100
parents 5b0a48631dd6
children 6122fb555251
files stress-tester/src/main/java/com/passus/st/PcapReporter.java
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/PcapReporter.java	Mon Jan 22 10:46:26 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/PcapReporter.java	Mon Jan 22 11:40:54 2018 +0100
@@ -90,11 +90,11 @@
             }
             Log4jConfigurationFactory.enableFactory(logLevel);
 
-            InetAddress addr = InetAddress.getByName(cl.getOptionValue("ri"));
-            SocketReporterClient reporterClient = new SocketReporterClient(new InetSocketAddress(addr, 11111), 2);
-            reporterClient.start();
+            ReporterRemoteDestination reporter = new ReporterRemoteDestination();
+            reporter.setHost(cl.getOptionValue("ri"));
+            reporter.start();
 
-            LocalHandler lh = new LocalHandler(reporterClient, cl.hasOption("ps"));
+            LocalHandler lh = new LocalHandler(reporter, cl.hasOption("ps"));
 
             PcapSessionEventSource eventSrc = new PcapSessionEventSource();
             eventSrc.setPcapFile(clArgs[0]);
@@ -142,12 +142,8 @@
             System.out.println("Broadcast finished. Duration " + PeriodFormatter.INSTANCE.reverseTransform(endTime - startTime) + ".");
 
             collector.collect();
-
             eventSrc.stop();
-
-            reporterClient.waitForEmptyQueue();
-            reporterClient.stop();
-
+            reporter.stop();
             collector.flush(true);
 
             printMetrics(summMetricsHandler.getMetrics(), startTime);
@@ -174,8 +170,8 @@
         private volatile int count;
         private volatile boolean finished;
 
-        public LocalHandler(SocketReporterClient reporterClient, boolean partialSession) {
-            reporter = new ReporterRemoteDestination(reporterClient);
+        public LocalHandler(ReporterRemoteDestination reporter, boolean partialSession) {
+            this.reporter = reporter;
             this.partialSession = partialSession;
         }