gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13189 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r13189 - gnunet/src/vpn
Date: Thu, 7 Oct 2010 07:41:54 +0200

Author: toelke
Date: 2010-10-07 07:41:54 +0200 (Thu, 07 Oct 2010)
New Revision: 13189

Modified:
   gnunet/src/vpn/gnunet-daemon-vpn.c
Log:
Reconnect to the service-dns if the connection is lost (or at the start of
gnunet for whatever reason)

Modified: gnunet/src/vpn/gnunet-daemon-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-vpn.c  2010-10-07 05:41:51 UTC (rev 13188)
+++ gnunet/src/vpn/gnunet-daemon-vpn.c  2010-10-07 05:41:54 UTC (rev 13189)
@@ -56,6 +56,8 @@
 
        pid_t helper_pid;
 
+       const struct GNUNET_CONFIGURATION_Handle *cfg;
+
        struct query_packet_list *head;
        struct query_packet_list *tail;
 
@@ -254,8 +256,16 @@
 
 }
 
+void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg);
+
+void reconnect_to_service_dns() {
+  mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", mycls.cfg);
+
+  GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, 
GNUNET_TIME_UNIT_FOREVER_REL);
+}
+
 void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) {
-       if (msg == NULL) return;
+       if (msg == NULL) reconnect_to_service_dns();
 
        if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) goto 
out;
 
@@ -290,9 +300,9 @@
   mycls.sched = sched;
   mycls.mst = GNUNET_SERVER_mst_create(&message_token, NULL);
 
-  mycls.dns_connection = GNUNET_CLIENT_connect (sched, "dns", cfg);
+  mycls.cfg = cfg;
 
-  GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, 
GNUNET_TIME_UNIT_FOREVER_REL);
+  reconnect_to_service_dns();
 
   GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, 
cls); 
   start_helper_and_schedule(mycls);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]