[hipl-commit] [tiny] Rev 3598: Removed dependency between maintenance and update.

  • From: Tim Just <tim.just@xxxxxxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Tue, 2 Mar 2010 16:07:31 +0200

Committer: Tim Just <tim.just@xxxxxxxxxxxxxx>
Date: Tue Mar 02 15:04:27 2010 +0100
Revision: 3598
Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: tiny

Log:
  Removed dependency between maintenance and update.
  
  Now the update module registers a maintenance function using
  libmodularization. The maintenance functions are called from
  periodic_maintenance().

Modified:
  M  hipd/maintenance.c
  M  lib/modularization/modularization.c
  M  modules/update/hipd/update.c
  M  modules/update/hipd/update.h

=== modified file 'hipd/maintenance.c'
--- hipd/maintenance.c  2010-03-01 14:15:03 +0000
+++ hipd/maintenance.c  2010-03-02 14:04:27 +0000
@@ -19,9 +19,7 @@
 
 #include "maintenance.h"
 #include "heartbeat.h"
-
-/* TODO Remove this include, when modularization is finished */
-#include "modules/update/hipd/update.h"
+#include "lib/modularization/modularization.h"
 
 #define FORCE_EXIT_COUNTER_START                5
 
@@ -222,21 +220,7 @@
         hip_for_each_ha(hip_handle_update_heartbeat_trigger, NULL);
     }
 
-    if (hip_wait_addr_changes_to_stabilize &&
-        address_change_time_counter != -1) {
-        if (address_change_time_counter == 0) {
-            address_change_time_counter = -1;
-            HIP_DEBUG("Triggering UPDATE\n");
-            err                         = hip_send_locators_to_all_peers();
-            if (err) {
-                HIP_ERROR("Error sending UPDATE\n");
-            }
-        } else {
-            HIP_DEBUG("Delay mobility triggering (count %d)\n",
-                      address_change_time_counter - 1);
-            address_change_time_counter--;
-        }
-    }
+    hip_run_maint_functions();
 
 //#ifdef CONFIG_HIP_UDPRELAY
     /* Clear the expired records from the relay hashtable. */

=== modified file 'lib/modularization/modularization.c'
--- lib/modularization/modularization.c 2010-03-02 11:01:05 +0000
+++ lib/modularization/modularization.c 2010-03-02 14:04:27 +0000
@@ -304,15 +304,12 @@
     int            err  = 0;
     hip_ll_node_t *iter = NULL;
 
-    HIP_IFEL(!maintenance_functions,
-             -1,
-             "Error on running maintenance functions.\n");
-
-    while ((iter = hip_ll_iterate(maintenance_functions, iter)) != NULL) {
-        ((struct maint_function*) iter->ptr)->func_ptr();
+    if(maintenance_functions != NULL) {
+        while ((iter = hip_ll_iterate(maintenance_functions, iter)) != NULL) {
+            ((struct maint_function*) iter->ptr)->func_ptr();
+        }
     }
 
-out_err:
     return err;
 }
 

=== modified file 'modules/update/hipd/update.c'
--- modules/update/hipd/update.c        2010-03-01 10:13:28 +0000
+++ modules/update/hipd/update.c        2010-03-02 14:04:27 +0000
@@ -881,6 +881,9 @@
                                  HIP_STATE_R2_SENT,
                                  &hip_handle_update,
                                  0);
+
+    hip_register_maint_function(&hip_update_maintenance, 0);
+
     return 0;
 }
 
@@ -912,3 +915,28 @@
 out_err:
     return err;
 }
+
+int hip_update_maintenance(void)
+{
+    int err = 0;
+
+    if (hip_wait_addr_changes_to_stabilize &&
+        address_change_time_counter != -1) {
+        if (address_change_time_counter == 0) {
+            address_change_time_counter = -1;
+
+            HIP_DEBUG("Triggering UPDATE\n");
+            err = hip_send_locators_to_all_peers();
+
+            if (err) {
+                HIP_ERROR("Error sending UPDATE\n");
+            }
+        } else {
+            HIP_DEBUG("Delay mobility triggering (count %d)\n",
+                      address_change_time_counter - 1);
+            address_change_time_counter--;
+        }
+    }
+
+    return err;
+}

=== modified file 'modules/update/hipd/update.h'
--- modules/update/hipd/update.h        2010-02-25 15:43:37 +0000
+++ modules/update/hipd/update.h        2010-03-02 14:04:27 +0000
@@ -84,4 +84,6 @@
 
 int hip_update_init_state(struct modular_state *state);
 
+int hip_update_maintenance(void);
+
 #endif /* HIP_HIPD_UPDATE_H */

Other related posts:

  • » [hipl-commit] [tiny] Rev 3598: Removed dependency between maintenance and update. - Tim Just