merge.
authorFlorian Pose <fp@igh-essen.com>
Fri, 08 Jul 2011 15:31:46 +0200
changeset 2080 42fbd117c3e3
parent 2079 56993027a2d0 (diff)
parent 2076 1baafcd263cc (current diff)
child 2084 eefccfa312ef
merge.
master/datagram.c
master/fsm_slave.c
master/master.c
--- a/master/datagram.c	Wed Jul 06 16:37:40 2011 +0200
+++ b/master/datagram.c	Fri Jul 08 15:31:46 2011 +0200
@@ -569,7 +569,7 @@
         ec_datagram_t *datagram
         )
 {
-    if (jiffies - datagram->stats_output_jiffies < HZ) {
+    if (jiffies - datagram->stats_output_jiffies > HZ) {
         datagram->stats_output_jiffies = jiffies;
     
         if (unlikely(datagram->skip_count)) {
--- a/master/master.c	Wed Jul 06 16:37:40 2011 +0200
+++ b/master/master.c	Fri Jul 08 15:31:46 2011 +0200
@@ -841,22 +841,24 @@
         ec_datagram_t *datagram /**< datagram */
         )
 {
-    ec_datagram_t *queued_datagram;
-
-    if (datagram->state == EC_DATAGRAM_SENT)
-        return;
-    // check, if the datagram is already queued
-    list_for_each_entry(queued_datagram, &master->datagram_queue, queue) {
-        if (queued_datagram == datagram) {
+    switch (datagram->state) {
+        case EC_DATAGRAM_QUEUED:
             datagram->skip_count++;
-            EC_MASTER_DBG(master, 1, "skipping datagram %p.\n", datagram);
+            EC_MASTER_DBG(master, 1, "Skipping already queued datagram %p.\n",
+                    datagram);
+            break;
+
+        case EC_DATAGRAM_SENT:
+            datagram->skip_count++;
+            EC_MASTER_DBG(master, 1, "Skipping already sent datagram %p.\n",
+                    datagram);
+            break;
+
+        default:
+            list_add_tail(&datagram->queue, &master->datagram_queue);
             datagram->state = EC_DATAGRAM_QUEUED;
-            return;
-        }
-    }
-
-    list_add_tail(&datagram->queue, &master->datagram_queue);
-    datagram->state = EC_DATAGRAM_QUEUED;
+            break;
+    }
 }