cancel any pending request to a client that just disconnects
authorPhilipp Tölke <toelke@in.tum.de>
Wed, 2 Nov 2011 10:21:36 +0000 (10:21 +0000)
committerPhilipp Tölke <toelke@in.tum.de>
Wed, 2 Nov 2011 10:21:36 +0000 (10:21 +0000)
src/vpn/gnunet-service-dns.c

index 6f9d0f1ad9830c9bffe3dd172390ee013a2d1ebb..489235ed4313bc495854312d7be99a3593192f38 100644 (file)
@@ -29,6 +29,7 @@
 #include "gnunet_network_lib.h"
 #include "gnunet_os_lib.h"
 #include "gnunet-service-dns-p.h"
+#include "gnunet_connection_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_applications.h"
 #include "gnunet-vpn-packet.h"
@@ -125,11 +126,21 @@ struct tunnel_state
   struct GNUNET_MESH_TransmitHandle *th;
 };
 
+static size_t send_answer (void *cls, size_t size, void *buf);
+
 static void
 client_disconnect(void* cls, struct GNUNET_SERVER_Client *client)
 {
   if (NULL == head) return;
 
+  if (head->client == client)
+    {
+      GNUNET_CONNECTION_notify_transmit_ready_cancel(server_notify);
+      server_notify = GNUNET_SERVER_notify_transmit_ready (head->next->client, ntohs (head->next->pkt.hdr.size),
+                                                           GNUNET_TIME_UNIT_FOREVER_REL,
+                                                           &send_answer, NULL);
+    }
+
   struct answer_packet_list *element = head;
   while (element != NULL)
     {