[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29255 - gnunet/src/identity
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29255 - gnunet/src/identity |
Date: |
Sat, 14 Sep 2013 18:49:45 +0200 |
Author: grothoff
Date: 2013-09-14 18:49:45 +0200 (Sat, 14 Sep 2013)
New Revision: 29255
Modified:
gnunet/src/identity/identity_api.c
Log:
-avoid queuing large number of START requests
Modified: gnunet/src/identity/identity_api.c
===================================================================
--- gnunet/src/identity/identity_api.c 2013-09-14 16:43:05 UTC (rev 29254)
+++ gnunet/src/identity/identity_api.c 2013-09-14 16:49:45 UTC (rev 29255)
@@ -540,16 +540,20 @@
GNUNET_assert (NULL == h->client);
h->client = GNUNET_CLIENT_connect ("identity", h->cfg);
GNUNET_assert (NULL != h->client);
- op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) +
- sizeof (struct GNUNET_MessageHeader));
- op->h = h;
- op->msg = (const struct GNUNET_MessageHeader *) &op[1];
- msg.size = htons (sizeof (msg));
- msg.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_START);
- memcpy (&op[1], &msg, sizeof (msg));
- GNUNET_CONTAINER_DLL_insert (h->op_head,
- h->op_tail,
- op);
+ if ( (NULL == h->op_head) ||
+ (GNUNET_MESSAGE_TYPE_IDENTITY_START != ntohs (h->op_head->msg->type)) )
+ {
+ op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) +
+ sizeof (struct GNUNET_MessageHeader));
+ op->h = h;
+ op->msg = (const struct GNUNET_MessageHeader *) &op[1];
+ msg.size = htons (sizeof (msg));
+ msg.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_START);
+ memcpy (&op[1], &msg, sizeof (msg));
+ GNUNET_CONTAINER_DLL_insert (h->op_head,
+ h->op_tail,
+ op);
+ }
transmit_next (h);
GNUNET_assert (NULL != h->th);
}
@@ -945,8 +949,11 @@
void
GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h)
{
+ struct GNUNET_IDENTITY_Operation *op;
+
GNUNET_assert (NULL != h);
- GNUNET_assert (h->op_head == h->op_tail);
+ while (NULL != (op = h->op_head))
+ GNUNET_IDENTITY_cancel (op);
if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (h->reconnect_task);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29255 - gnunet/src/identity,
gnunet <=