GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
* @file util/mq.c
* @brief general purpose request queue
*/
-
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "mq",__VA_ARGS__)
handled = GNUNET_YES;
}
}
-
+
if (GNUNET_NO == handled)
LOG (GNUNET_ERROR_TYPE_WARNING, "no handler for message of type %d\n", ntohs (mh->type));
}
/**
* Send a message with the give message queue.
* May only be called once per message.
- *
+ *
* @param mq message queue
* @param ev the envelope with the message to send.
*/
{
GNUNET_assert (NULL != mq);
GNUNET_assert (NULL == ev->parent_queue);
-
+
/* is the implementation busy? queue it! */
if (NULL != mq->current_envelope)
{
return;
}
-
GNUNET_assert (NULL != mq->envelope_tail);
GNUNET_assert (NULL != mq->envelope_head);
mq->current_envelope = mq->envelope_head;
void *impl_state)
{
struct ServerClientSocketState *state = impl_state;
-
+
GNUNET_assert (NULL != mq);
GNUNET_assert (NULL != state);
GNUNET_SERVER_client_drop (state->client);
GNUNET_MQ_impl_send_commit (mq);
- state->th =
+ state->th =
GNUNET_SERVER_notify_transmit_ready (state->client, ntohs (msg->size),
GNUNET_TIME_UNIT_FOREVER_REL,
&transmit_queued, mq);
struct ClientConnectionState *state;
state = mq->impl_state;
-
+
if (NULL == msg)
{
GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_READ);
GNUNET_MQ_impl_send_commit (mq);
- state->th =
- GNUNET_CLIENT_notify_transmit_ready (state->connection, ntohs (msg->size),
+ state->th =
+ GNUNET_CLIENT_notify_transmit_ready (state->connection, ntohs (msg->size),
GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_NO,
&connection_client_transmit_queued, mq);
}
if (NULL == mq->assoc_map)
return NULL;
val = GNUNET_CONTAINER_multihashmap32_get (mq->assoc_map, request_id);
- GNUNET_assert (NULL != val);
- GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap32_remove (mq->assoc_map, request_id, val));
+ GNUNET_CONTAINER_multihashmap32_remove_all (mq->assoc_map, request_id);
return val;
}
mq->current_envelope = NULL;
}
+ if (NULL != mq->assoc_map)
+ {
+ GNUNET_CONTAINER_multihashmap32_destroy (mq->assoc_map);
+ mq->assoc_map = NULL;
+ }
+
GNUNET_free (mq);
}