gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r31578 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r31578 - gnunet/src/gns
Date: Thu, 19 Dec 2013 19:39:00 +0100

Author: LRN
Date: 2013-12-19 19:39:00 +0100 (Thu, 19 Dec 2013)
New Revision: 31578

Modified:
   gnunet/src/gns/gnunet-gns-helper-service-w32.c
Log:
Correctly send trailing empty header

Modified: gnunet/src/gns/gnunet-gns-helper-service-w32.c
===================================================================
--- gnunet/src/gns/gnunet-gns-helper-service-w32.c      2013-12-19 18:38:57 UTC 
(rev 31577)
+++ gnunet/src/gns/gnunet-gns-helper-service-w32.c      2013-12-19 18:39:00 UTC 
(rev 31578)
@@ -141,6 +141,11 @@
    */
   struct GNUNET_SERVER_TransmitHandle *th;
 
+
+  /**
+   * Handle for the client to which to send
+   */
+  struct GNUNET_SERVER_Client *client;
 };
 
 
@@ -193,6 +198,17 @@
   memcpy (buf, tcc->msg, msize);
   GNUNET_free (tcc->msg);
   GNUNET_free (tcc);
+  for (tcc = tcc_head; tcc; tcc = tcc->next)
+  {
+    if (NULL == tcc->th)
+    {
+      tcc->th = GNUNET_SERVER_notify_transmit_ready (tcc->client,
+          ntohs (tcc->msg->size),
+          GNUNET_TIME_UNIT_FOREVER_REL,
+          &transmit_callback, tcc);
+      break;
+    }
+  }
   return msize;
 }
 
@@ -218,18 +234,11 @@
   }
   tcc = GNUNET_new (struct TransmitCallbackContext);
   tcc->msg = msg;
-  if (NULL ==
-      (tcc->th =
-       GNUNET_SERVER_notify_transmit_ready (client,
-                                           ntohs (msg->size),
-                                            GNUNET_TIME_UNIT_FOREVER_REL,
-                                            &transmit_callback, tcc)))
-  {
-    GNUNET_break (0);
-    GNUNET_free (msg);
-    GNUNET_free (tcc);
-    return;
-  }
+  tcc->client = client;
+  tcc->th = GNUNET_SERVER_notify_transmit_ready (client,
+      ntohs (msg->size),
+      GNUNET_TIME_UNIT_FOREVER_REL,
+      &transmit_callback, tcc);
   GNUNET_CONTAINER_DLL_insert (tcc_head, tcc_tail, tcc);
 }
 
@@ -355,7 +364,6 @@
     }
     size += blobsize;
   }
-  size += sizeof (struct GNUNET_MessageHeader);
   size_recalc = sizeof (struct GNUNET_W32RESOLVER_GetMessage) + sizeof 
(WSAQUERYSETW);
   msg = GNUNET_malloc (size);
   msg->header.size = htons (size - sizeof (struct GNUNET_MessageHeader));
@@ -518,9 +526,7 @@
     }
     he->h_addr_list[j] = NULL;
   }
-  msgend = (struct GNUNET_MessageHeader *) ptr;
-  ptr += sizeof (struct GNUNET_MessageHeader);
-  size_recalc += sizeof (struct GNUNET_MessageHeader);
+  msgend = GNUNET_new (struct GNUNET_MessageHeader);
 
   msgend->type = htons (GNUNET_MESSAGE_TYPE_W32RESOLVER_RESPONSE);
   msgend->size = htons (sizeof (struct GNUNET_MessageHeader));
@@ -531,6 +537,7 @@
   }
   MarshallWSAQUERYSETW (qs, &rq->sc);
   transmit (rq->client, &msg->header);
+  transmit (rq->client, msgend);
   GNUNET_free_non_null (rq->name);
   if (rq->u8name)
     free (rq->u8name);




reply via email to

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