[pisa-src] r1114 - trunk/pisacd

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Tue, 13 Oct 2009 15:27:35 +0200

Author: tjansen
Date: Tue Oct 13 15:27:35 2009
New Revision: 1114

Log:
Switched heartbeat in the client over to the brand new scheduler.

Modified:
   trunk/pisacd/cdheartbeat.c
   trunk/pisacd/cdheartbeat.h
   trunk/pisacd/cdmain.c

Modified: trunk/pisacd/cdheartbeat.c
==============================================================================
--- trunk/pisacd/cdheartbeat.c  Tue Oct 13 15:27:00 2009        (r1113)
+++ trunk/pisacd/cdheartbeat.c  Tue Oct 13 15:27:35 2009        (r1114)
@@ -14,6 +14,7 @@
 #include "cdctx.h"
 #include "cdderegister.h"
 #include "cdpending.h"
+#include "scheduler.h"
 
 /**
  * Handle a HEARTBEAT_ACK packet from a server. Update the last received time
@@ -99,10 +100,13 @@
  * Check all connections for their last received time to see if we need to
  * send a heartbeat.
  */
-void pisa_client_heartbeat_all(void)
+void pisa_task_heartbeat(void *data)
 {
        time_t t;
+       struct timeval delay = {2, 0};
 
        time(&t);
        pisa_conmgr_iterate_connected(cd_ctx.conlist, 
pisa_client_send_heartbeat, &t);
+
+       pisa_sched_add(pisa_task_heartbeat, &delay, NULL);
 }

Modified: trunk/pisacd/cdheartbeat.h
==============================================================================
--- trunk/pisacd/cdheartbeat.h  Tue Oct 13 15:27:00 2009        (r1113)
+++ trunk/pisacd/cdheartbeat.h  Tue Oct 13 15:27:35 2009        (r1114)
@@ -8,7 +8,7 @@
 
 #include "packet.h"
 
-void pisa_client_heartbeat_all(void);
+void pisa_task_heartbeat(void *data);
 
 /* handlers for tunnel control packets */
 void pisa_recv_heartbeat_ack(pisa_packet *pkt, struct sockaddr_in6 *addr);

Modified: trunk/pisacd/cdmain.c
==============================================================================
--- trunk/pisacd/cdmain.c       Tue Oct 13 15:27:00 2009        (r1113)
+++ trunk/pisacd/cdmain.c       Tue Oct 13 15:27:35 2009        (r1114)
@@ -263,6 +263,7 @@
 
        pisa_sched_init(&cd_ctx.scheduler);
        pisa_sched_add_now(pisa_maintenance_test, NULL);
+       pisa_sched_add_now(pisa_task_heartbeat, NULL);
 }
 
 static void cd_deinit(void)
@@ -430,9 +431,6 @@
                if (cd_ctx.scheduler)
                        pisa_sched_run();
 
-               if (cd_ctx.is_cd_running){
-                       pisa_client_heartbeat_all();
-               }
                pending = pisa_pending_update();
        }
 }

Other related posts:

  • » [pisa-src] r1114 - trunk/pisacd - Thomas Jansen