[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26853 - gnunet/src/consensus
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26853 - gnunet/src/consensus |
Date: |
Thu, 11 Apr 2013 15:56:22 +0200 |
Author: grothoff
Date: 2013-04-11 15:56:22 +0200 (Thu, 11 Apr 2013)
New Revision: 26853
Modified:
gnunet/src/consensus/consensus_api.c
Log:
-consensus fix
Modified: gnunet/src/consensus/consensus_api.c
===================================================================
--- gnunet/src/consensus/consensus_api.c 2013-04-11 13:50:06 UTC (rev
26852)
+++ gnunet/src/consensus/consensus_api.c 2013-04-11 13:56:22 UTC (rev
26853)
@@ -138,13 +138,9 @@
unsigned int conclude_min_size;
struct QueuedMessage *messages_head;
+
struct QueuedMessage *messages_tail;
- /**
- * GNUNET_YES when currently in a section where destroy may not be
- * called.
- */
- int may_not_destroy;
};
@@ -265,17 +261,16 @@
*/
static void
handle_conclude_done (struct GNUNET_CONSENSUS_Handle *consensus,
- const struct GNUNET_MessageHeader *msg)
+ const struct GNUNET_MessageHeader *msg)
{
- GNUNET_assert (NULL != consensus->conclude_cb);
- consensus->may_not_destroy = GNUNET_YES;
- consensus->conclude_cb (consensus->conclude_cls);
- consensus->may_not_destroy = GNUNET_NO;
+ GNUNET_CONSENSUS_ConcludeCallback cc;
+
+ GNUNET_assert (NULL != (cc = consensus->conclude_cb));
consensus->conclude_cb = NULL;
+ cc (consensus->conclude_cls);
}
-
/**
* Type of a function to call when we receive a message
* from the service.
@@ -290,7 +285,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "received message from consensus service\n");
- if (msg == NULL)
+ if (NULL == msg)
{
/* Error, timeout, death */
LOG (GNUNET_ERROR_TYPE_ERROR, "error receiving\n");
@@ -299,7 +294,8 @@
consensus->new_element_cb (consensus->new_element_cls, NULL);
return;
}
-
+ GNUNET_CLIENT_receive (consensus->client, &message_handler, consensus,
+ GNUNET_TIME_UNIT_FOREVER_REL);
switch (ntohs (msg->type))
{
case GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT:
@@ -311,8 +307,6 @@
default:
GNUNET_break (0);
}
- GNUNET_CLIENT_receive (consensus->client, &message_handler, consensus,
- GNUNET_TIME_UNIT_FOREVER_REL);
}
/**
@@ -509,11 +503,6 @@
void
GNUNET_CONSENSUS_destroy (struct GNUNET_CONSENSUS_Handle *consensus)
{
- if (GNUNET_YES == consensus->may_not_destroy)
- {
- LOG (GNUNET_ERROR_TYPE_ERROR, "destroy may not be called right now\n");
- GNUNET_assert (0);
- }
if (consensus->client != NULL)
{
GNUNET_CLIENT_disconnect (consensus->client);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26853 - gnunet/src/consensus,
gnunet <=