for (op = incoming_head; NULL != op; op = op->next)
if (op->state->suggest_id == id)
+ {
+ // FIXME: remove this assertion once the corresponding bug is gone!
+ GNUNET_assert (GNUNET_YES == op->is_incoming);
return op;
+ }
return NULL;
}
static void
incoming_destroy (struct Operation *incoming)
{
+ GNUNET_assert (GNUNET_YES == incoming->is_incoming);
GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming);
if (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task)
{
GNUNET_SCHEDULER_cancel (incoming->state->timeout_task);
incoming->state->timeout_task = GNUNET_SCHEDULER_NO_TASK;
}
+ GNUNET_assert (NULL != incoming->state);
GNUNET_free (incoming->state);
+ // make sure that the tunnel end handler will not
+ // destroy us again
+ incoming->vt = NULL;
+ incoming->state = NULL;
}
static void
incoming_retire (struct Operation *incoming)
{
+ GNUNET_assert (GNUNET_YES == incoming->is_incoming);
incoming->is_incoming = GNUNET_NO;
+ GNUNET_assert (NULL != incoming->state);
GNUNET_free (incoming->state);
incoming->state = NULL;
GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming);
{
struct GNUNET_MQ_Envelope *mqm;
struct GNUNET_SET_RequestMessage *cmsg;
-
+
+ GNUNET_assert (GNUNET_YES == incoming->is_incoming);
+ GNUNET_assert (NULL != incoming->state);
GNUNET_assert (NULL != incoming->spec);
GNUNET_assert (0 == incoming->state->suggest_id);
incoming->state->suggest_id = suggest_id++;
struct Listener *listener;
struct OperationSpecification *spec;
+ GNUNET_assert (GNUNET_YES == op->is_incoming);
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got op request\n");
if (GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST != ntohs (mh->type))
GNUNET_CONTAINER_DLL_insert (set->ops_head, set->ops_tail, op);
op->channel = GNUNET_MESH_channel_create (mesh, op, &msg->target_peer,
- GNUNET_APPLICATION_TYPE_SET,
- GNUNET_MESH_OPTION_RELIABLE);
+ GNUNET_APPLICATION_TYPE_SET,
+ GNUNET_MESH_OPTION_RELIABLE);
op->mq = GNUNET_MESH_mq_create (op->channel);
handle_incoming_disconnect (struct Operation *op)
{
GNUNET_assert (GNUNET_YES == op->is_incoming);
- if (NULL == op->channel)
- return;
incoming_destroy (op);
+ op->vt = NULL;
}
*/
static void
channel_end_cb (void *cls,
- const struct GNUNET_MESH_Channel *channel, void *channel_ctx)
+ const struct GNUNET_MESH_Channel *channel, void *channel_ctx)
{
struct Operation *op = channel_ctx;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"channel end cb called\n");
op->channel = NULL;
+ /* the vt can be null if a client already requested canceling op. */
if (NULL != op->vt)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "calling peer disconnect due to channel end\n");
op->vt->peer_disconnect (op);
+ }
+
+ if (GNUNET_YES == op->keep)
+ return;
+
/* mesh will never call us with the context again! */
GNUNET_free (channel_ctx);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "channel end cb finished\n");
}
/**
- * Functions with this signature are called whenever any message is
- * received via the mesh channel.
+ * Functions with this signature are called whenever a message is
+ * received via a mesh channel.
*
* The msg_handler is a virtual table set in initially either when a peer
* creates a new channel with us (channel_new_cb), or once we create a new channel
{dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE, 0},
{dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO, 0},
{dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF, 0},
+ {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF_PART, 0},
{NULL, 0, 0}
};
static const uint32_t mesh_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0};