summaryrefslogtreecommitdiff
path: root/src/set
diff options
context:
space:
mode:
Diffstat (limited to 'src/set')
-rw-r--r--src/set/gnunet-service-set.c31
-rw-r--r--src/set/gnunet-service-set.h9
-rw-r--r--src/set/gnunet-service-set_union.c23
3 files changed, 35 insertions, 28 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 217b89d6d..75122395d 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -221,11 +221,7 @@ incoming_destroy (struct Operation *op)
GNUNET_SCHEDULER_cancel (op->timeout_task);
op->timeout_task = NULL;
}
- if (NULL != (channel = op->channel))
- {
- op->channel = NULL;
- GNUNET_CADET_channel_destroy (channel);
- }
+ _GSS_operation_destroy2 (op);
}
@@ -1199,9 +1195,30 @@ channel_end_cb (void *channel_ctx,
{
struct Operation *op = channel_ctx;
+ op->channel = NULL;
+ _GSS_operation_destroy2 (op);
+}
+
+
+/**
+ * This function probably should not exist
+ * and be replaced by inlining more specific
+ * logic in the various places where it is called.
+ */
+void
+_GSS_operation_destroy2 (struct Operation *op)
+{
+ struct GNUNET_CADET_Channel *channel;
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"channel_end_cb called\n");
- op->channel = NULL;
+ if (NULL != (channel = op->channel))
+ {
+ /* This will free op; called conditionally as this helper function
+ is also called from within the channel disconnect handler. */
+ op->channel = NULL;
+ GNUNET_CADET_channel_destroy (channel);
+ }
if (NULL != op->listener)
incoming_destroy (op);
else if (NULL != op->set)
@@ -1376,7 +1393,7 @@ handle_client_reject (void *cls,
"Peer request (op %u, app %s) rejected by client\n",
op->listener->operation,
GNUNET_h2s (&cs->listener->app_id));
- GNUNET_CADET_channel_destroy (op->channel);
+ _GSS_operation_destroy2 (op);
GNUNET_SERVICE_client_continue (cs->client);
}
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h
index f7c262eac..a58b22995 100644
--- a/src/set/gnunet-service-set.h
+++ b/src/set/gnunet-service-set.h
@@ -630,6 +630,15 @@ _GSS_operation_destroy (struct Operation *op,
/**
+ * This function probably should not exist
+ * and be replaced by inlining more specific
+ * logic in the various places where it is called.
+ */
+void
+_GSS_operation_destroy2 (struct Operation *op);
+
+
+/**
* Get the table with implementing functions for set union.
*
* @return the operation specific VTable
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index c3c14f1ba..8c0c52d64 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -1367,25 +1367,6 @@ send_client_element (struct Operation *op,
/**
- * Destroy remote channel.
- *
- * @param op operation
- */
-void destroy_channel (struct Operation *op)
-{
- struct GNUNET_CADET_Channel *channel;
-
- if (NULL != (channel = op->channel))
- {
- /* This will free op; called conditionally as this helper function
- is also called from within the channel disconnect handler. */
- op->channel = NULL;
- GNUNET_CADET_channel_destroy (channel);
- }
-}
-
-
-/**
* Signal to the client that the operation has finished and
* destroy the operation.
*
@@ -1467,7 +1448,7 @@ maybe_finish (struct Operation *op)
{
op->state->phase = PHASE_DONE;
send_client_done (op);
- destroy_channel (op);
+ _GSS_operation_destroy2 (op);
}
}
}
@@ -1896,7 +1877,7 @@ handle_union_p2p_full_done (void *cls,
op->state->phase = PHASE_DONE;
GNUNET_CADET_receive_done (op->channel);
send_client_done (op);
- destroy_channel (op);
+ _GSS_operation_destroy2 (op);
return;
}
break;