[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32586 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32586 - gnunet/src/testbed |
Date: |
Fri, 7 Mar 2014 16:21:05 +0100 |
Author: harsha
Date: 2014-03-07 16:21:05 +0100 (Fri, 07 Mar 2014)
New Revision: 32586
Modified:
gnunet/src/testbed/testbed_logger_api.c
Log:
- Warn upon deleting unsent message.
- Send the message immediately if its size equals to the buffer size.
Modified: gnunet/src/testbed/testbed_logger_api.c
===================================================================
--- gnunet/src/testbed/testbed_logger_api.c 2014-03-07 15:16:35 UTC (rev
32585)
+++ gnunet/src/testbed/testbed_logger_api.c 2014-03-07 15:21:05 UTC (rev
32586)
@@ -352,15 +352,21 @@
GNUNET_TESTBED_LOGGER_disconnect (struct GNUNET_TESTBED_LOGGER_Handle *h)
{
struct MessageQueue *mq;
+ unsigned int lost;
if (GNUNET_SCHEDULER_NO_TASK != h->flush_completion_task)
GNUNET_SCHEDULER_cancel (h->flush_completion_task);
+ lost = 0;
while (NULL != (mq = h->mq_head))
{
GNUNET_CONTAINER_DLL_remove (h->mq_head, h->mq_tail, mq);
GNUNET_free (mq->msg);
GNUNET_free (mq);
+ lost++;
}
+ if (0 != lost)
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Cleaning up %u unsent logger
message[s]\n",
+ lost);
GNUNET_CLIENT_disconnect (h->client);
GNUNET_free (h);
}
@@ -383,7 +389,7 @@
GNUNET_assert (0 != size);
GNUNET_assert (NULL != data);
- GNUNET_assert (size < (BUFFER_SIZE - sizeof (struct GNUNET_MessageHeader)));
+ GNUNET_assert (size <= (BUFFER_SIZE - sizeof (struct GNUNET_MessageHeader)));
fit_size = sizeof (struct GNUNET_MessageHeader) + h->bs + size;
if ( BUFFER_SIZE < fit_size )
dispatch_buffer (h);
@@ -392,12 +398,15 @@
h->buf = GNUNET_malloc (size);
h->bs = size;
memcpy (h->buf, data, size);
- return;
+ goto dispatch_ready;
}
h->buf = GNUNET_realloc (h->buf, h->bs + size);
memcpy (h->buf + h->bs, data, size);
h->bs += size;
- return;
+
+ dispatch_ready:
+ if (BUFFER_SIZE == fit_size)
+ dispatch_buffer (h);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32586 - gnunet/src/testbed,
gnunet <=