BUGFIX: Make sure to always spawn a new sequence matcher when a sequence matcher...
authorJanus Varmarken <varmarken@gmail.com>
Mon, 21 Jan 2019 23:51:03 +0000 (15:51 -0800)
committerJanus Varmarken <varmarken@gmail.com>
Mon, 21 Jan 2019 23:51:03 +0000 (15:51 -0800)
Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/detection/layer2/Layer2ClusterMatcher.java

index b416727..79a945f 100644 (file)
@@ -79,11 +79,11 @@ public class Layer2ClusterMatcher extends AbstractClusterMatcher implements Laye
                                 newPacket.getTimestamp().isAfter(matchers[i][j+1].getLastPacket().getTimestamp())) {
                             matchers[i][j+1] = sm;
                         }
-                        // We always want to have a sequence matcher in state 0, regardless of if the one that advanced
-                        // from state zero replaced a different one in state 1 or not.
-                        if (sm.getMatchedPacketsCount() == 1) {
-                            matchers[i][j] = new Layer2SequenceMatcher(sm.getTargetSequence());
-                        }
+                    }
+                    // We always want to have a sequence matcher in state 0, regardless of if the one that advanced
+                    // from state zero completed its matching or if it replaced a different one in state 1 or not.
+                    if (sm.getMatchedPacketsCount() == 1) {
+                        matchers[i][j] = new Layer2SequenceMatcher(sm.getTargetSequence());
                     }
                 }
             }