// XXX: check first if any changes to the underlying
// set are still pending
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Finishing setop in Task {%s}\n",
- debug_str_task_key (&task->key));
+ "P%u: Finishing setop in Task {%s} (%u/%u)\n",
+ session->local_peer_idx,
+ debug_str_task_key (&task->key),
+ (unsigned int) task->step->finished_tasks,
+ (unsigned int) task->step->tasks_len);
if (NULL != output_rfn)
{
rfn_commit (output_rfn, task_other_peer (task));
peers to wait. */
GNUNET_SET_operation_cancel (setop->op);
setop->op = NULL;
+ finish_task (task);
}
#endif
}
task->step->finished_tasks++;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "P%u: Finishing setop in Task {%s} (now %u/%u tasks finished in step)\n",
+ task->step->session->local_peer_idx,
+ debug_str_task_key (&task->key),
+ (unsigned int) task->step->finished_tasks,
+ (unsigned int) task->step->tasks_len);
+
if (task->step->finished_tasks == task->step->tasks_len)
finish_step (task->step);
}
struct GNUNET_MQ_Envelope *ev;
struct GNUNET_SET_ResultMessage *rm;
+ if (GNUNET_YES == op->state->client_done_sent) {
+ return;
+ }
+
+ if (PHASE_DONE != op->state->phase) {
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "union operation failed\n");
+ ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT);
+ rm->result_status = htons (GNUNET_SET_STATUS_FAILURE);
+ rm->request_id = htonl (op->client_request_id);
+ rm->element_type = htons (0);
+ GNUNET_MQ_send (op->set->cs->mq,
+ ev);
+ return;
+ }
+
+ op->state->client_done_sent = GNUNET_YES;
+
LOG (GNUNET_ERROR_TYPE_INFO,
"Signalling client that union operation is done\n");
ev = GNUNET_MQ_msg (rm,
ev);
}
-/**
- * Signal to the client that the operation has finished and
- * destroy the operation.
- *
- * @param cls operation to destroy
- */
-static void
-send_client_done_and_destroy (void *cls)
-{
- struct Operation *op = cls;
- send_client_done (cls);
- /* Will also call the union-specific cancel function. */
- _GSS_operation_destroy (op,
- GNUNET_YES);
-}
-
/**
* Tests if the operation is finished, and if so notify.
struct GNUNET_MQ_Envelope *ev;
op->state->phase = PHASE_DONE;
+ /* FIXME: temporary hack, send message twice and add notification to second message,
+ * so we can be pretty sure that the other party gets at least one of these
+ * (since tunnel end handler is currently broken).
+ */
+ ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OVER);
+ GNUNET_MQ_send (op->mq,
+ ev);
ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OVER);
GNUNET_MQ_notify_sent (ev,
&send_client_done,
/* We sent the full set, and got the response for that. We're done. */
op->state->phase = PHASE_DONE;
GNUNET_CADET_receive_done (op->channel);
+ /* FIXME: temporary hack, send message twice and add notification to second message,
+ * so we can be pretty sure that the other party gets at least one of these
+ * (since tunnel end handler is currently broken).
+ */
+ ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OVER);
+ GNUNET_MQ_send (op->mq,
+ ev);
ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OVER);
GNUNET_MQ_notify_sent (ev,
&send_client_done,
static void
union_channel_death (struct Operation *op)
{
+ send_client_done (op);
_GSS_operation_destroy (op,
GNUNET_YES);
}