cpu: fix bug when TrafficGen deschedules event
authorXiangyu Dong <rioshering@gmail.com>
Thu, 30 Jan 2014 04:35:04 +0000 (22:35 -0600)
committerXiangyu Dong <rioshering@gmail.com>
Thu, 30 Jan 2014 04:35:04 +0000 (22:35 -0600)
Committed by: Nilay Vaish <nilay@cs.wisc.edu>

src/cpu/testers/traffic_gen/traffic_gen.cc

index 0f006e67e8d4bf560cfd1ee11d18ce3351c81b8d..b7f1ecd4ee0c604d978fed0104d9b9281d185f2c 100644 (file)
@@ -119,6 +119,11 @@ TrafficGen::initState()
 unsigned int
 TrafficGen::drain(DrainManager *dm)
 {
+    if (!updateEvent.scheduled()) {
+        // no event has been scheduled yet (e.g. switched from atomic mode)
+        return 0;
+    }
+
     if (retryPkt == NULL) {
         // shut things down
         nextPacketTick = MaxTick;