diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-10-04 13:59:39 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-10-04 13:59:39 +0200 |
commit | 4fe6ffb8fbffbcc728118f20326fc699295aa1fc (patch) | |
tree | 5106981370961200a387c6dc5d95201832c32acf /src | |
parent | a995680a1408fc756a6ced539f4d3b46ed21b770 (diff) |
delay cancelling listen operations to avoid rejecting operations before they had a chance to start, fixes misc. test case failures related to set
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_set_service.h | 2 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c | 8 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct_alice.c | 8 | ||||
-rw-r--r-- | src/set/gnunet-service-set.c | 6 | ||||
-rw-r--r-- | src/set/test_set_intersection_result_full.c | 2 | ||||
-rw-r--r-- | src/set/test_set_union_result_symmetric.c | 2 |
6 files changed, 9 insertions, 19 deletions
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h index 6e822d82e7..dfe9b8954b 100644 --- a/src/include/gnunet_set_service.h +++ b/src/include/gnunet_set_service.h @@ -452,6 +452,8 @@ GNUNET_SET_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Cancel the given listen operation. After calling cancel, the * listen callback for this listen handle will not be called again. + * Note that cancelling a listen operation will automatically reject + * all operations that have not yet been accepted. * * @param lh handle for the listen operation */ diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c index c0b33f8efe..57f275c81e 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c @@ -260,8 +260,6 @@ destroy_service_session (struct AliceServiceSession *s) } if (NULL != s->intersection_listen) { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Set intersection, listen still up!\n"); GNUNET_SET_listen_cancel (s->intersection_listen); s->intersection_listen = NULL; } @@ -274,8 +272,6 @@ destroy_service_session (struct AliceServiceSession *s) } if (NULL != s->intersection_set) { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Set intersection, set still there!\n"); GNUNET_SET_destroy (s->intersection_set); s->intersection_set = NULL; } @@ -809,10 +805,6 @@ cb_intersection_request_alice (void *cls, prepare_client_end_notification (s); return; } - GNUNET_SET_destroy (s->intersection_set); - s->intersection_set = NULL; - GNUNET_SET_listen_cancel (s->intersection_listen); - s->intersection_listen = NULL; } diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c index a55d039009..fcb1ce0322 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c @@ -243,8 +243,6 @@ free_element_cb (void *cls, static void destroy_service_session (struct AliceServiceSession *s) { - unsigned int i; - if (GNUNET_YES == s->in_destroy) return; s->in_destroy = GNUNET_YES; @@ -285,7 +283,7 @@ destroy_service_session (struct AliceServiceSession *s) } if (NULL != s->sorted_elements) { - for (i=0;i<s->used_element_count;i++) + for (unsigned int i=0;i<s->used_element_count;i++) gcry_mpi_release (s->sorted_elements[i].value); GNUNET_free (s->sorted_elements); s->sorted_elements = NULL; @@ -1043,10 +1041,6 @@ cb_intersection_request_alice (void *cls, prepare_client_end_notification (s); return; } - GNUNET_SET_destroy (s->intersection_set); - s->intersection_set = NULL; - GNUNET_SET_listen_cancel (s->intersection_listen); - s->intersection_listen = NULL; } diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index 617a336618..42d06b2753 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c @@ -628,7 +628,13 @@ client_disconnect_cb (void *cls, GNUNET_CADET_close_port (listener->open_port); listener->open_port = NULL; while (NULL != (op = listener->op_head)) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Destroying incoming operation `%u' from peer `%s'\n", + (unsigned int) op->client_request_id, + GNUNET_i2s (&op->peer)); incoming_destroy (op); + } GNUNET_CONTAINER_DLL_remove (listener_head, listener_tail, listener); diff --git a/src/set/test_set_intersection_result_full.c b/src/set/test_set_intersection_result_full.c index a36aae4d5b..16de983cf0 100644 --- a/src/set/test_set_intersection_result_full.c +++ b/src/set/test_set_intersection_result_full.c @@ -131,8 +131,6 @@ listen_cb (void *cls, "starting intersection by accepting and committing\n"); GNUNET_assert (NULL != context_msg); GNUNET_assert (ntohs (context_msg->type) == GNUNET_MESSAGE_TYPE_DUMMY); - GNUNET_SET_listen_cancel (listen_handle); - listen_handle = NULL; oh2 = GNUNET_SET_accept (request, GNUNET_SET_RESULT_FULL, (struct GNUNET_SET_Option[]) { 0 }, diff --git a/src/set/test_set_union_result_symmetric.c b/src/set/test_set_union_result_symmetric.c index f81c7b8f7a..3008e5aac0 100644 --- a/src/set/test_set_union_result_symmetric.c +++ b/src/set/test_set_union_result_symmetric.c @@ -182,8 +182,6 @@ listen_cb (void *cls, GNUNET_assert (ntohs (context_msg->type) == GNUNET_MESSAGE_TYPE_DUMMY); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "listen cb called\n"); - GNUNET_SET_listen_cancel (listen_handle); - listen_handle = NULL; oh2 = GNUNET_SET_accept (request, GNUNET_SET_RESULT_SYMMETRIC, (struct GNUNET_SET_Option[]) { 0 }, |