gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r17193 - gnunet/src/vpn
Date: Wed, 5 Oct 2011 10:58:50 +0200

Author: toelke
Date: 2011-10-05 10:58:50 +0200 (Wed, 05 Oct 2011)
New Revision: 17193

Modified:
   gnunet/src/vpn/gnunet-daemon-vpn-dns.c
   gnunet/src/vpn/gnunet-daemon-vpn-helper.c
Log:
bug

Modified: gnunet/src/vpn/gnunet-daemon-vpn-dns.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-vpn-dns.c      2011-10-05 08:54:30 UTC (rev 
17192)
+++ gnunet/src/vpn/gnunet-daemon-vpn-dns.c      2011-10-05 08:58:50 UTC (rev 
17193)
@@ -46,6 +46,8 @@
 struct answer_packet_list *answer_proc_head;
 struct answer_packet_list *answer_proc_tail;
 
+struct GNUNET_CLIENT_TransmitHandle *dns_transmit_handle;
+
 /**
  * Callback called by notify_transmit_ready; sends dns-queries or 
rehijack-messages
  * to the service-dns
@@ -55,6 +57,7 @@
 send_query (void *cls __attribute__ ((unused)), size_t size, void *buf)
 {
   size_t len;
+  dns_transmit_handle = NULL;
 
   /*
    * Send the rehijack-message
@@ -97,14 +100,14 @@
    */
   if (head != NULL)
   {
-    GNUNET_CLIENT_notify_transmit_ready (dns_connection,
+    dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
                                          ntohs (head->pkt.hdr.size),
                                          GNUNET_TIME_UNIT_FOREVER_REL,
                                          GNUNET_YES, &send_query, NULL);
   }
   else if (restart_hijack == 1)
   {
-    GNUNET_CLIENT_notify_transmit_ready (dns_connection,
+    dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
                                          sizeof (struct GNUNET_MessageHeader),
                                          GNUNET_TIME_UNIT_FOREVER_REL,
                                          GNUNET_YES, &send_query, NULL);
@@ -140,14 +143,14 @@
     return;
 
   /* If a packet is already in the list, schedule to send it */
-  if (head != NULL)
-    GNUNET_CLIENT_notify_transmit_ready (dns_connection,
+  if (dns_transmit_handle == NULL && head != NULL)
+    dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
                                          ntohs (head->pkt.hdr.size),
                                          GNUNET_TIME_UNIT_FOREVER_REL,
                                          GNUNET_YES, &send_query, NULL);
-  else if (restart_hijack == 1)
+  else if (dns_transmit_handle == NULL && restart_hijack == 1)
   {
-    GNUNET_CLIENT_notify_transmit_ready (dns_connection,
+    dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
                                          sizeof (struct GNUNET_MessageHeader),
                                          GNUNET_TIME_UNIT_FOREVER_REL,
                                          GNUNET_YES, &send_query, NULL);
@@ -166,6 +169,9 @@
   /* the service disconnected, reconnect after short wait */
   if (msg == NULL)
   {
+    if (dns_transmit_handle != NULL)
+      GNUNET_CLIENT_notify_transmit_ready_cancel(dns_transmit_handle);
+    dns_transmit_handle = NULL;
     GNUNET_CLIENT_disconnect (dns_connection, GNUNET_NO);
     dns_connection = NULL;
     conn_task =

Modified: gnunet/src/vpn/gnunet-daemon-vpn-helper.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-vpn-helper.c   2011-10-05 08:54:30 UTC (rev 
17192)
+++ gnunet/src/vpn/gnunet-daemon-vpn-helper.c   2011-10-05 08:58:50 UTC (rev 
17193)
@@ -45,6 +45,8 @@
 
 struct GNUNET_VPN_HELPER_Handle *helper_handle;
 
+extern struct GNUNET_CLIENT_TransmitHandle* dns_transmit_handle;
+
 /**
  * The tunnels that will be used to send tcp- and udp-packets
  */
@@ -137,8 +139,8 @@
    * The routing-table gets flushed if an interface disappears.
    */
   restart_hijack = 1;
-  if (NULL != dns_connection)
-    GNUNET_CLIENT_notify_transmit_ready (dns_connection,
+  if (NULL != dns_connection && dns_transmit_handle == NULL)
+    dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
                                          sizeof (struct GNUNET_MessageHeader),
                                          GNUNET_TIME_UNIT_FOREVER_REL,
                                          GNUNET_YES, &send_query, NULL);
@@ -445,10 +447,10 @@
 
       GNUNET_assert (head != NULL);
 
-      if (dns_connection != NULL)
-        GNUNET_CLIENT_notify_transmit_ready (dns_connection, len,
-                                             GNUNET_TIME_UNIT_FOREVER_REL,
-                                             GNUNET_YES, &send_query, NULL);
+      if (dns_connection != NULL && dns_transmit_handle == NULL)
+        dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready 
(dns_connection, len,
+                                                                   
GNUNET_TIME_UNIT_FOREVER_REL,
+                                                                   GNUNET_YES, 
&send_query, NULL);
     }
     else
     {




reply via email to

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