cleanup
authorPhilipp Tölke <toelke@in.tum.de>
Thu, 21 Apr 2011 13:44:49 +0000 (13:44 +0000)
committerPhilipp Tölke <toelke@in.tum.de>
Thu, 21 Apr 2011 13:44:49 +0000 (13:44 +0000)
src/vpn/gnunet-daemon-vpn.c
src/vpn/gnunet-service-dns.c

index e835fbcfa36eae270af661770425c3530f7c8f2d..885c77aad7abce20735a2575e383f5353e99d347 100644 (file)
@@ -560,14 +560,6 @@ receive_tcp_back (void *cls, struct GNUNET_MESH_Tunnel* tunnel,
   return GNUNET_OK;
 }
 
-void init_mesh (void* cls, struct GNUNET_MESH_Handle* server, const struct GNUNET_PeerIdentity* my_identity, const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pubkey) {
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connected to MESH, I am %x\n", *((unsigned long*)my_identity));
-}
-
-void connect_mesh (void* cls, const struct GNUNET_PeerIdentity* peer, const struct GNUNET_TRANSPORT_ATS_Information *atsi) {
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connected to peer %x\n", *((unsigned long*)peer));
-}
-
 /**
  * Main function that will be run by the scheduler.
  *
index 9fb88bed2d231465be2c65c9bb3bc405592100d7..d861e32b27be7c53a2bcfa3e626aa7f944987868 100644 (file)
@@ -257,6 +257,9 @@ send_mesh_query (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 static void
 send_rev_query(void * cls, const struct GNUNET_SCHEDULER_TaskContext *tc) {
+    if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+      return;
+
     struct dns_pkt_parsed* pdns = (struct dns_pkt_parsed*) cls;
 
     unsigned short id = pdns->s.id;
@@ -504,7 +507,8 @@ receive_query(void *cls,
       }
 
     GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Query for '%s'; namelen=%d\n", pdns->queries[0]->name, pdns->queries[0]->namelen);
-    /* The query is for a PTR of a previosly resolved virtual IP */
+
+    /* This is a PTR-Query. Check if it is for "our" network */
     if (htons(pdns->queries[0]->qtype) == 12 &&
        74 == pdns->queries[0]->namelen)
       {
@@ -973,10 +977,11 @@ run (void *cls,
      const struct GNUNET_CONFIGURATION_Handle *cfg_)
 {
   static const struct GNUNET_SERVER_MessageHandler handlers[] = {
-      /* callback, cls, type, size */
-       {&receive_query, NULL, GNUNET_MESSAGE_TYPE_LOCAL_QUERY_DNS, 0},
-       {&rehijack, NULL, GNUNET_MESSAGE_TYPE_REHIJACK, sizeof(struct GNUNET_MessageHeader)},
-       {NULL, NULL, 0, 0}
+    /* callback, cls, type, size */
+    {&receive_query, NULL, GNUNET_MESSAGE_TYPE_LOCAL_QUERY_DNS, 0},
+    {&rehijack, NULL, GNUNET_MESSAGE_TYPE_REHIJACK,
+     sizeof (struct GNUNET_MessageHeader)},
+    {NULL, NULL, 0, 0}
   };
 
 
@@ -995,20 +1000,20 @@ run (void *cls,
   cfg = cfg_;
 
   unsigned int i;
-  for (i = 0; i < 65536; i++) {
+  for (i = 0; i < 65536; i++)
+    {
       query_states[i].valid = GNUNET_NO;
-  }
+    }
 
-  dht = GNUNET_DHT_connect(cfg, 1024);
+  dht = GNUNET_DHT_connect (cfg, 1024);
 
-  open_port();
+  open_port ();
 
   GNUNET_SCHEDULER_add_now (publish_names, NULL);
 
   GNUNET_SERVER_add_handlers (server, handlers);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                               &cleanup_task,
-                               cls);
+                                &cleanup_task, cls);
 }
 
 /**