aboutsummaryrefslogtreecommitdiff
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.c7
3 files changed, 37 insertions, 10 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)
221 GNUNET_SCHEDULER_cancel (op->timeout_task); 221 GNUNET_SCHEDULER_cancel (op->timeout_task);
222 op->timeout_task = NULL; 222 op->timeout_task = NULL;
223 } 223 }
224 if (NULL != (channel = op->channel)) 224 _GSS_operation_destroy2 (op);
225 {
226 op->channel = NULL;
227 GNUNET_CADET_channel_destroy (channel);
228 }
229} 225}
230 226
231 227
@@ -1199,9 +1195,30 @@ channel_end_cb (void *channel_ctx,
1199{ 1195{
1200 struct Operation *op = channel_ctx; 1196 struct Operation *op = channel_ctx;
1201 1197
1198 op->channel = NULL;
1199 _GSS_operation_destroy2 (op);
1200}
1201
1202
1203/**
1204 * This function probably should not exist
1205 * and be replaced by inlining more specific
1206 * logic in the various places where it is called.
1207 */
1208void
1209_GSS_operation_destroy2 (struct Operation *op)
1210{
1211 struct GNUNET_CADET_Channel *channel;
1212
1202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1213 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1203 "channel_end_cb called\n"); 1214 "channel_end_cb called\n");
1204 op->channel = NULL; 1215 if (NULL != (channel = op->channel))
1216 {
1217 /* This will free op; called conditionally as this helper function
1218 is also called from within the channel disconnect handler. */
1219 op->channel = NULL;
1220 GNUNET_CADET_channel_destroy (channel);
1221 }
1205 if (NULL != op->listener) 1222 if (NULL != op->listener)
1206 incoming_destroy (op); 1223 incoming_destroy (op);
1207 else if (NULL != op->set) 1224 else if (NULL != op->set)
@@ -1376,7 +1393,7 @@ handle_client_reject (void *cls,
1376 "Peer request (op %u, app %s) rejected by client\n", 1393 "Peer request (op %u, app %s) rejected by client\n",
1377 op->listener->operation, 1394 op->listener->operation,
1378 GNUNET_h2s (&cs->listener->app_id)); 1395 GNUNET_h2s (&cs->listener->app_id));
1379 GNUNET_CADET_channel_destroy (op->channel); 1396 _GSS_operation_destroy2 (op);
1380 GNUNET_SERVICE_client_continue (cs->client); 1397 GNUNET_SERVICE_client_continue (cs->client);
1381} 1398}
1382 1399
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,
630 630
631 631
632/** 632/**
633 * This function probably should not exist
634 * and be replaced by inlining more specific
635 * logic in the various places where it is called.
636 */
637void
638_GSS_operation_destroy2 (struct Operation *op);
639
640
641/**
633 * Get the table with implementing functions for set union. 642 * Get the table with implementing functions for set union.
634 * 643 *
635 * @return the operation specific VTable 644 * @return the operation specific VTable
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index c1268948a..73d3f5c83 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -1399,7 +1399,8 @@ send_client_done (void *cls)
1399 struct GNUNET_MQ_Envelope *ev; 1399 struct GNUNET_MQ_Envelope *ev;
1400 struct GNUNET_SET_ResultMessage *rm; 1400 struct GNUNET_SET_ResultMessage *rm;
1401 1401
1402 if (GNUNET_YES == op->state->client_done_sent) { 1402 if (GNUNET_YES == op->state->client_done_sent)
1403 {
1403 return; 1404 return;
1404 } 1405 }
1405 1406
@@ -1476,7 +1477,7 @@ maybe_finish (struct Operation *op)
1476 { 1477 {
1477 op->state->phase = PHASE_DONE; 1478 op->state->phase = PHASE_DONE;
1478 send_client_done (op); 1479 send_client_done (op);
1479 destroy_channel (op); 1480 _GSS_operation_destroy2 (op);
1480 } 1481 }
1481 } 1482 }
1482} 1483}
@@ -1905,7 +1906,7 @@ handle_union_p2p_full_done (void *cls,
1905 op->state->phase = PHASE_DONE; 1906 op->state->phase = PHASE_DONE;
1906 GNUNET_CADET_receive_done (op->channel); 1907 GNUNET_CADET_receive_done (op->channel);
1907 send_client_done (op); 1908 send_client_done (op);
1908 destroy_channel (op); 1909 _GSS_operation_destroy2 (op);
1909 return; 1910 return;
1910 } 1911 }
1911 break; 1912 break;