[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30748 - in gnunet/src: conversation core include mesh util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30748 - in gnunet/src: conversation core include mesh util |
Date: |
Sat, 16 Nov 2013 18:41:14 +0100 |
Author: grothoff
Date: 2013-11-16 18:41:13 +0100 (Sat, 16 Nov 2013)
New Revision: 30748
Modified:
gnunet/src/conversation/gnunet-conversation.c
gnunet/src/core/core_api.c
gnunet/src/include/gnunet_mq_lib.h
gnunet/src/mesh/mesh_api.c
gnunet/src/util/mq.c
Log:
-remove GNUNET_MQ_impl_send_commit, make it part of send_continue, to ensure
calling the continuation _last_
Modified: gnunet/src/conversation/gnunet-conversation.c
===================================================================
--- gnunet/src/conversation/gnunet-conversation.c 2013-11-16 17:24:56 UTC
(rev 30747)
+++ gnunet/src/conversation/gnunet-conversation.c 2013-11-16 17:41:13 UTC
(rev 30748)
@@ -787,7 +787,7 @@
case PS_ERROR:
FPRINTF (stderr,
"%s",
- _("There is no call that could be suspended right now.\n"));
+ _("There is no call that could be resumed right now.\n"));
return;
case PS_LISTEN:
/* expected state, do resume logic */
@@ -1054,6 +1054,8 @@
ptr = &message[strlen (commands[i].command)];
while (isspace ((int) *ptr))
ptr++;
+ if ('\0' == ptr)
+ ptr = NULL;
commands[i].Action (ptr);
}
Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c 2013-11-16 17:24:56 UTC (rev 30747)
+++ gnunet/src/core/core_api.c 2013-11-16 17:41:13 UTC (rev 30748)
@@ -1424,7 +1424,6 @@
return 0;
}
memcpy (buf, mh, msg_size);
- GNUNET_MQ_impl_send_commit (mq);
GNUNET_MQ_impl_send_continue (mq);
return msg_size;
}
@@ -1448,7 +1447,7 @@
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "core-mq", "Sending queued message
(size %u)\n",
ntohs (msg->size));
mqs->th = GNUNET_CORE_notify_transmit_ready (mqs->core, GNUNET_YES, 0,
- GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_TIME_UNIT_FOREVER_REL,
&mqs->target,
ntohs (msg->size), core_mq_ntr,
mq);
}
@@ -1459,7 +1458,7 @@
* destruction of a message queue.
* Implementations must not free @a mq, but should
* take care of @a impl_state.
- *
+ *
* @param mq the message queue to destroy
* @param impl_state state of the implementation
*/
@@ -1478,7 +1477,7 @@
/**
* Implementation function that cancels the currently sent message.
- *
+ *
* @param mq message queue
* @param impl_state state specific to the implementation
*/
Modified: gnunet/src/include/gnunet_mq_lib.h
===================================================================
--- gnunet/src/include/gnunet_mq_lib.h 2013-11-16 17:24:56 UTC (rev 30747)
+++ gnunet/src/include/gnunet_mq_lib.h 2013-11-16 17:41:13 UTC (rev 30748)
@@ -389,9 +389,9 @@
/**
- * Replace the handlers of a message queue with new handlers.
- * Takes effect immediately, even for messages that already have been
received, but for
- * with the handler has not been called.
+ * Replace the handlers of a message queue with new handlers. Takes
+ * effect immediately, even for messages that already have been
+ * received, but for with the handler has not been called.
*
* If the message queue does not support receiving messages,
* this function has no effect.
@@ -506,16 +506,6 @@
GNUNET_MQ_impl_state (struct GNUNET_MQ_Handle *mq);
-/**
- * Mark the current message as irrevocably sent, but do not
- * proceed with sending the next message.
- * Will call the appropriate GNUNET_MQ_NotifyCallback, if any.
- *
- * @param mq message queue
- */
-void
-GNUNET_MQ_impl_send_commit (struct GNUNET_MQ_Handle *mq);
-
/** @} */ /* end of group mq */
#endif
Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c 2013-11-16 17:24:56 UTC (rev 30747)
+++ gnunet/src/mesh/mesh_api.c 2013-11-16 17:41:13 UTC (rev 30748)
@@ -1710,7 +1710,6 @@
GNUNET_assert (msize <= size);
memcpy (buf, msg, msize);
GNUNET_MQ_impl_send_continue (mq);
- GNUNET_MQ_impl_send_commit (mq);
return msize;
}
Modified: gnunet/src/util/mq.c
===================================================================
--- gnunet/src/util/mq.c 2013-11-16 17:24:56 UTC (rev 30747)
+++ gnunet/src/util/mq.c 2013-11-16 17:41:13 UTC (rev 30748)
@@ -121,12 +121,6 @@
struct GNUNET_MQ_Envelope *current_envelope;
/**
- * Has the current envelope been commited?
- * Either GNUNET_YES or GNUNET_NO.
- */
- int commited;
-
- /**
* Map of associations, lazily allocated
*/
struct GNUNET_CONTAINER_MultiHashMap32 *assoc_map;
@@ -265,25 +259,27 @@
void
GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq)
{
+ struct GNUNET_MQ_Envelope *current_envelope;
+
/* call is only valid if we're actually currently sending
* a message */
- GNUNET_assert (NULL != mq);
- GNUNET_assert (NULL != mq->current_envelope);
- GNUNET_assert (GNUNET_YES == mq->commited);
- mq->commited = GNUNET_NO;
- GNUNET_free (mq->current_envelope);
+ current_envelope = mq->current_envelope;
+ GNUNET_assert (NULL != current_envelope);
if (NULL == mq->envelope_head)
{
mq->current_envelope = NULL;
- return;
}
-
- GNUNET_assert (NULL != mq->envelope_tail);
- GNUNET_assert (NULL != mq->envelope_head);
- mq->current_envelope = mq->envelope_head;
- GNUNET_CONTAINER_DLL_remove (mq->envelope_head, mq->envelope_tail,
- mq->current_envelope);
- mq->send_impl (mq, mq->current_envelope->mh, mq->impl_state);
+ else
+ {
+ mq->current_envelope = mq->envelope_head;
+ GNUNET_CONTAINER_DLL_remove (mq->envelope_head,
+ mq->envelope_tail,
+ mq->current_envelope);
+ mq->send_impl (mq, mq->current_envelope->mh, mq->impl_state);
+ }
+ if (NULL != current_envelope->sent_cb)
+ current_envelope->sent_cb (current_envelope->sent_cls);
+ GNUNET_free (current_envelope);
}
@@ -362,25 +358,6 @@
}
-
-/**
- * Mark the current message as irrevocably sent, but do not
- * proceed with sending the next message.
- * Will call the appropriate GNUNET_MQ_NotifyCallback, if any.
- *
- * @param mq message queue
- */
-void
-GNUNET_MQ_impl_send_commit (struct GNUNET_MQ_Handle *mq)
-{
- GNUNET_assert (NULL != mq->current_envelope);
- GNUNET_assert (GNUNET_NO == mq->commited);
- mq->commited = GNUNET_YES;
- if (NULL != mq->current_envelope->sent_cb)
- mq->current_envelope->sent_cb (mq->current_envelope->sent_cls);
-}
-
-
struct GNUNET_MQ_Envelope *
GNUNET_MQ_msg_ (struct GNUNET_MessageHeader **mhp, uint16_t size, uint16_t
type)
{
@@ -479,9 +456,6 @@
GNUNET_assert (NULL != mq);
GNUNET_assert (NULL != state);
-
- GNUNET_MQ_impl_send_commit (mq);
-
state->th =
GNUNET_SERVER_notify_transmit_ready (state->client, ntohs (msg->size),
GNUNET_TIME_UNIT_FOREVER_REL,
@@ -596,9 +570,6 @@
GNUNET_assert (NULL != state);
GNUNET_assert (NULL == state->th);
-
- GNUNET_MQ_impl_send_commit (mq);
-
state->th =
GNUNET_CLIENT_notify_transmit_ready (state->connection, ntohs
(msg->size),
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_NO,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30748 - in gnunet/src: conversation core include mesh util,
gnunet <=