-
-/**
- * Free a transmission that was already queued with all resources
- * associated to the request.
- *
- * @param queue Queue handler to cancel.
- * @param clear_cls Is it necessary to free associated cls?
- */
-void
-GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls)
-{
- struct MeshPeer *peer;
- struct MeshFlowControl *fc;
- int fwd;
-
- fwd = queue->fwd;
- peer = queue->peer;
- GNUNET_assert (NULL != queue->c);
- fc = fwd ? &queue->c->fwd_fc : &queue->c->bck_fc;
-
- if (GNUNET_YES == clear_cls)
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG, " queue destroy type %s\n",
- GNUNET_MESH_DEBUG_M2S (queue->type));
- switch (queue->type)
- {
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
- case GNUNET_MESSAGE_TYPE_MESH_TUNNEL3_DESTROY:
- LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n");
- GNUNET_break (GNUNET_YES == queue->c->destroy);
- /* fall through */
- case GNUNET_MESSAGE_TYPE_MESH_FWD:
- case GNUNET_MESSAGE_TYPE_MESH_BCK:
- case GNUNET_MESSAGE_TYPE_MESH_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_POLL:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
- LOG (GNUNET_ERROR_TYPE_DEBUG, " prebuilt message\n");;
- GNUNET_free_non_null (queue->cls);
- break;
-
- default:
- GNUNET_break (0);
- LOG (GNUNET_ERROR_TYPE_ERROR, " type %s unknown!\n",
- GNUNET_MESH_DEBUG_M2S (queue->type));
- }
-
- }
- GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue);
-
- if (queue->type != GNUNET_MESSAGE_TYPE_MESH_ACK &&
- queue->type != GNUNET_MESSAGE_TYPE_MESH_POLL)
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N- %p %u\n", fc, fc->queue_n);
- fc->queue_n--;
- peer->queue_n--;
- }
- if (NULL != queue->c)
- {
- queue->c->pending_messages--;
- if (NULL != queue->c->t)
- {
- queue->c->t->pending_messages--;
- }
- }
-
- GNUNET_free (queue);
-}
-
-