diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-08-09 16:35:32 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-08-09 16:35:32 +0200 |
commit | 7caba06019ecc5775d3dbb513b70f52f620affb5 (patch) | |
tree | 93696c0ab1a31e3744fc375015fb0b6dbd95003d /src/set/gnunet-service-set.c | |
parent | 1ded1c1bb3bcb16d1770f03b299fcaa0a0c2d813 (diff) | |
download | gnunet-7caba06019ecc5775d3dbb513b70f52f620affb5.tar.gz gnunet-7caba06019ecc5775d3dbb513b70f52f620affb5.zip |
change CADET channel destroy API to not call the callback if the client initiated the channel's destruction
Diffstat (limited to 'src/set/gnunet-service-set.c')
-rw-r--r-- | src/set/gnunet-service-set.c | 31 |
1 files changed, 24 insertions, 7 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 | */ | ||
1208 | void | ||
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 | ||