diff options
33 files changed, 173 insertions, 115 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 138c95df4..dd48edd5b 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c | |||
@@ -104,7 +104,7 @@ void | |||
104 | GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h) | 104 | GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h) |
105 | { | 105 | { |
106 | if (h->client != NULL) | 106 | if (h->client != NULL) |
107 | GNUNET_CLIENT_disconnect (h->client); | 107 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
108 | GNUNET_CONFIGURATION_destroy (h->cfg); | 108 | GNUNET_CONFIGURATION_destroy (h->cfg); |
109 | GNUNET_free (h); | 109 | GNUNET_free (h); |
110 | } | 110 | } |
@@ -274,7 +274,7 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
274 | ? "START" | 274 | ? "START" |
275 | : "STOP", | 275 | : "STOP", |
276 | (const char*) &sc[1]); | 276 | (const char*) &sc[1]); |
277 | GNUNET_CLIENT_disconnect (sc->h->client); | 277 | GNUNET_CLIENT_disconnect (sc->h->client, GNUNET_NO); |
278 | sc->h->client = GNUNET_CLIENT_connect (sc->h->sched, | 278 | sc->h->client = GNUNET_CLIENT_connect (sc->h->sched, |
279 | "arm", | 279 | "arm", |
280 | sc->h->cfg); | 280 | sc->h->cfg); |
diff --git a/src/core/core_api.c b/src/core/core_api.c index b597a7424..e03971e10 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -257,7 +257,7 @@ static void | |||
257 | reconnect (struct GNUNET_CORE_Handle *h) | 257 | reconnect (struct GNUNET_CORE_Handle *h) |
258 | { | 258 | { |
259 | if (h->client_notifications != NULL) | 259 | if (h->client_notifications != NULL) |
260 | GNUNET_CLIENT_disconnect (h->client_notifications); | 260 | GNUNET_CLIENT_disconnect (h->client_notifications, GNUNET_NO); |
261 | h->currently_down = GNUNET_YES; | 261 | h->currently_down = GNUNET_YES; |
262 | h->client_notifications = GNUNET_CLIENT_connect (h->sched, "core", h->cfg); | 262 | h->client_notifications = GNUNET_CLIENT_connect (h->sched, "core", h->cfg); |
263 | if (h->client_notifications == NULL) | 263 | if (h->client_notifications == NULL) |
@@ -793,7 +793,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) | |||
793 | if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK) | 793 | if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK) |
794 | GNUNET_SCHEDULER_cancel (handle->sched, handle->reconnect_task); | 794 | GNUNET_SCHEDULER_cancel (handle->sched, handle->reconnect_task); |
795 | if (handle->client_notifications != NULL) | 795 | if (handle->client_notifications != NULL) |
796 | GNUNET_CLIENT_disconnect (handle->client_notifications); | 796 | GNUNET_CLIENT_disconnect (handle->client_notifications, GNUNET_NO); |
797 | GNUNET_free_non_null (handle->solicit_buffer); | 797 | GNUNET_free_non_null (handle->solicit_buffer); |
798 | GNUNET_free (handle); | 798 | GNUNET_free (handle); |
799 | } | 799 | } |
diff --git a/src/core/core_api_peer_get_info.c b/src/core/core_api_peer_get_info.c index c28ae2feb..7ba4abecf 100644 --- a/src/core/core_api_peer_get_info.c +++ b/src/core/core_api_peer_get_info.c | |||
@@ -68,7 +68,7 @@ receive_info (void *cls, | |||
68 | if (irc->info != NULL) | 68 | if (irc->info != NULL) |
69 | irc->info (irc->info_cls, | 69 | irc->info (irc->info_cls, |
70 | NULL, zbw, zbw, 0, 0); | 70 | NULL, zbw, zbw, 0, 0); |
71 | GNUNET_CLIENT_disconnect (irc->client); | 71 | GNUNET_CLIENT_disconnect (irc->client, GNUNET_NO); |
72 | GNUNET_free (irc); | 72 | GNUNET_free (irc); |
73 | return; | 73 | return; |
74 | } | 74 | } |
@@ -79,7 +79,7 @@ receive_info (void *cls, | |||
79 | if (irc->info != NULL) | 79 | if (irc->info != NULL) |
80 | irc->info (irc->info_cls, | 80 | irc->info (irc->info_cls, |
81 | NULL, zbw, zbw, 0, 0); | 81 | NULL, zbw, zbw, 0, 0); |
82 | GNUNET_CLIENT_disconnect (irc->client); | 82 | GNUNET_CLIENT_disconnect (irc->client, GNUNET_NO); |
83 | GNUNET_free (irc); | 83 | GNUNET_free (irc); |
84 | return; | 84 | return; |
85 | } | 85 | } |
@@ -91,7 +91,7 @@ receive_info (void *cls, | |||
91 | cim->bw_out, | 91 | cim->bw_out, |
92 | ntohl (cim->reserved_amount), | 92 | ntohl (cim->reserved_amount), |
93 | GNUNET_ntohll (cim->preference)); | 93 | GNUNET_ntohll (cim->preference)); |
94 | GNUNET_CLIENT_disconnect (irc->client); | 94 | GNUNET_CLIENT_disconnect (irc->client, GNUNET_NO); |
95 | GNUNET_free (irc); | 95 | GNUNET_free (irc); |
96 | } | 96 | } |
97 | 97 | ||
@@ -170,7 +170,7 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_SCHEDULER_Handle *sched, | |||
170 | void | 170 | void |
171 | GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequestContext *irc) | 171 | GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequestContext *irc) |
172 | { | 172 | { |
173 | GNUNET_CLIENT_disconnect (irc->client); | 173 | GNUNET_CLIENT_disconnect (irc->client, GNUNET_NO); |
174 | GNUNET_free (irc); | 174 | GNUNET_free (irc); |
175 | } | 175 | } |
176 | 176 | ||
diff --git a/src/core/core_api_peer_request.c b/src/core/core_api_peer_request.c index ec5fae32b..2ce3ac1c3 100644 --- a/src/core/core_api_peer_request.c +++ b/src/core/core_api_peer_request.c | |||
@@ -95,7 +95,7 @@ send_request (void *cls, | |||
95 | prh->cont, | 95 | prh->cont, |
96 | prh->cont_cls, | 96 | prh->cont_cls, |
97 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 97 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
98 | GNUNET_CLIENT_disconnect (prh->client); | 98 | GNUNET_CLIENT_disconnect (prh->client, GNUNET_NO); |
99 | GNUNET_free (prh); | 99 | GNUNET_free (prh); |
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
@@ -110,7 +110,7 @@ send_request (void *cls, | |||
110 | prh->cont, | 110 | prh->cont, |
111 | prh->cont_cls, | 111 | prh->cont_cls, |
112 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 112 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
113 | GNUNET_CLIENT_disconnect (prh->client); | 113 | GNUNET_CLIENT_disconnect (prh->client, GNUNET_YES); |
114 | GNUNET_free (prh); | 114 | GNUNET_free (prh); |
115 | return sizeof (msg); | 115 | return sizeof (msg); |
116 | } | 116 | } |
@@ -176,7 +176,7 @@ GNUNET_CORE_peer_request_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
176 | void | 176 | void |
177 | GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle *req) | 177 | GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle *req) |
178 | { | 178 | { |
179 | GNUNET_CLIENT_disconnect (req->client); | 179 | GNUNET_CLIENT_disconnect (req->client, GNUNET_NO); |
180 | GNUNET_free (req); | 180 | GNUNET_free (req); |
181 | } | 181 | } |
182 | 182 | ||
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index 3b7c3a2ed..cb70cc1f3 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -159,7 +159,7 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | |||
159 | GNUNET_break (0); | 159 | GNUNET_break (0); |
160 | } | 160 | } |
161 | if (h->client != NULL) | 161 | if (h->client != NULL) |
162 | GNUNET_CLIENT_disconnect (h->client); | 162 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
163 | GNUNET_ARM_stop_services (h->cfg, h->sched, "datastore", NULL); | 163 | GNUNET_ARM_stop_services (h->cfg, h->sched, "datastore", NULL); |
164 | GNUNET_free (h); | 164 | GNUNET_free (h); |
165 | } | 165 | } |
@@ -188,7 +188,7 @@ with_status_response_handler (void *cls, | |||
188 | if (msg == NULL) | 188 | if (msg == NULL) |
189 | { | 189 | { |
190 | h->response_proc = NULL; | 190 | h->response_proc = NULL; |
191 | GNUNET_CLIENT_disconnect (h->client); | 191 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
192 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); | 192 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); |
193 | cont (h->response_proc_cls, | 193 | cont (h->response_proc_cls, |
194 | GNUNET_SYSERR, | 194 | GNUNET_SYSERR, |
@@ -200,7 +200,7 @@ with_status_response_handler (void *cls, | |||
200 | { | 200 | { |
201 | GNUNET_break (0); | 201 | GNUNET_break (0); |
202 | h->response_proc = NULL; | 202 | h->response_proc = NULL; |
203 | GNUNET_CLIENT_disconnect (h->client); | 203 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
204 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); | 204 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); |
205 | cont (h->response_proc_cls, | 205 | cont (h->response_proc_cls, |
206 | GNUNET_SYSERR, | 206 | GNUNET_SYSERR, |
@@ -469,7 +469,7 @@ with_result_response_handler (void *cls, | |||
469 | if (msg == NULL) | 469 | if (msg == NULL) |
470 | { | 470 | { |
471 | h->response_proc = NULL; | 471 | h->response_proc = NULL; |
472 | GNUNET_CLIENT_disconnect (h->client); | 472 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
473 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); | 473 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); |
474 | cont (h->response_proc_cls, | 474 | cont (h->response_proc_cls, |
475 | NULL, 0, NULL, 0, 0, 0, | 475 | NULL, 0, NULL, 0, 0, 0, |
@@ -493,7 +493,7 @@ with_result_response_handler (void *cls, | |||
493 | (ntohs(msg->type) != GNUNET_MESSAGE_TYPE_DATASTORE_DATA) ) | 493 | (ntohs(msg->type) != GNUNET_MESSAGE_TYPE_DATASTORE_DATA) ) |
494 | { | 494 | { |
495 | GNUNET_break (0); | 495 | GNUNET_break (0); |
496 | GNUNET_CLIENT_disconnect (h->client); | 496 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
497 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); | 497 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); |
498 | h->response_proc = NULL; | 498 | h->response_proc = NULL; |
499 | cont (h->response_proc_cls, | 499 | cont (h->response_proc_cls, |
@@ -506,7 +506,7 @@ with_result_response_handler (void *cls, | |||
506 | if (ntohs(msg->size) != msize + sizeof(struct DataMessage)) | 506 | if (ntohs(msg->size) != msize + sizeof(struct DataMessage)) |
507 | { | 507 | { |
508 | GNUNET_break (0); | 508 | GNUNET_break (0); |
509 | GNUNET_CLIENT_disconnect (h->client); | 509 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
510 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); | 510 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); |
511 | h->response_proc = NULL; | 511 | h->response_proc = NULL; |
512 | cont (h->response_proc_cls, | 512 | cont (h->response_proc_cls, |
@@ -558,7 +558,7 @@ GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h, | |||
558 | } | 558 | } |
559 | cont = h->response_proc; | 559 | cont = h->response_proc; |
560 | h->response_proc = NULL; | 560 | h->response_proc = NULL; |
561 | GNUNET_CLIENT_disconnect (h->client); | 561 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
562 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); | 562 | h->client = GNUNET_CLIENT_connect (h->sched, "datastore", h->cfg); |
563 | cont (h->response_proc_cls, | 563 | cont (h->response_proc_cls, |
564 | NULL, 0, NULL, 0, 0, 0, | 564 | NULL, 0, NULL, 0, 0, 0, |
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 9356b79ed..78b453349 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -131,6 +131,11 @@ struct Plugin | |||
131 | * Handle for pending get request. | 131 | * Handle for pending get request. |
132 | */ | 132 | */ |
133 | struct GNUNET_STATISTICS_GetHandle *stat_get; | 133 | struct GNUNET_STATISTICS_GetHandle *stat_get; |
134 | |||
135 | /** | ||
136 | * Pending task with scheduler for running the next request. | ||
137 | */ | ||
138 | GNUNET_SCHEDULER_TaskIdentifier next_task; | ||
134 | 139 | ||
135 | /** | 140 | /** |
136 | * How much data are we currently storing | 141 | * How much data are we currently storing |
@@ -540,9 +545,9 @@ sqlite_next_request_cont (void *cls, | |||
540 | struct GNUNET_TIME_Absolute expiration; | 545 | struct GNUNET_TIME_Absolute expiration; |
541 | const GNUNET_HashCode *key; | 546 | const GNUNET_HashCode *key; |
542 | const void *data; | 547 | const void *data; |
543 | 548 | ||
544 | |||
545 | plugin = nc->plugin; | 549 | plugin = nc->plugin; |
550 | plugin->next_task = GNUNET_SCHEDULER_NO_TASK; | ||
546 | if ( (GNUNET_YES == nc->end_it) || | 551 | if ( (GNUNET_YES == nc->end_it) || |
547 | (GNUNET_OK != (nc->prep(nc->prep_cls, | 552 | (GNUNET_OK != (nc->prep(nc->prep_cls, |
548 | nc))) ) | 553 | nc))) ) |
@@ -668,10 +673,9 @@ sqlite_next_request (void *next_cls, | |||
668 | 673 | ||
669 | if (GNUNET_YES == end_it) | 674 | if (GNUNET_YES == end_it) |
670 | nc->end_it = GNUNET_YES; | 675 | nc->end_it = GNUNET_YES; |
671 | GNUNET_SCHEDULER_add_continuation (nc->plugin->env->sched, | 676 | nc->plugin->next_task = GNUNET_SCHEDULER_add_now (nc->plugin->env->sched, |
672 | &sqlite_next_request_cont, | 677 | &sqlite_next_request_cont, |
673 | nc, | 678 | nc); |
674 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
675 | } | 679 | } |
676 | 680 | ||
677 | 681 | ||
@@ -1646,6 +1650,12 @@ libgnunet_plugin_datastore_sqlite_done (void *cls) | |||
1646 | GNUNET_STATISTICS_get_cancel (plugin->stat_get); | 1650 | GNUNET_STATISTICS_get_cancel (plugin->stat_get); |
1647 | plugin->stat_get = NULL; | 1651 | plugin->stat_get = NULL; |
1648 | } | 1652 | } |
1653 | if (plugin->next_task != GNUNET_SCHEDULER_NO_TASK) | ||
1654 | { | ||
1655 | GNUNET_SCHEDULER_cancel (plugin->env->sched, | ||
1656 | plugin->next_task); | ||
1657 | plugin->next_task = GNUNET_SCHEDULER_NO_TASK; | ||
1658 | } | ||
1649 | fn = NULL; | 1659 | fn = NULL; |
1650 | if (plugin->drop_on_shutdown) | 1660 | if (plugin->drop_on_shutdown) |
1651 | fn = GNUNET_strdup (plugin->fn); | 1661 | fn = GNUNET_strdup (plugin->fn); |
diff --git a/src/dv/dv_api.c b/src/dv/dv_api.c index 54cb8720c..15ef822d6 100644 --- a/src/dv/dv_api.c +++ b/src/dv/dv_api.c | |||
@@ -384,7 +384,7 @@ void GNUNET_DV_disconnect(struct GNUNET_DV_Handle *handle) | |||
384 | } | 384 | } |
385 | if (handle->client != NULL) /* Finally, disconnect from the service */ | 385 | if (handle->client != NULL) /* Finally, disconnect from the service */ |
386 | { | 386 | { |
387 | GNUNET_CLIENT_disconnect (handle->client); | 387 | GNUNET_CLIENT_disconnect (handle->client, GNUNET_NO); |
388 | handle->client = NULL; | 388 | handle->client = NULL; |
389 | } | 389 | } |
390 | 390 | ||
diff --git a/src/fs/fs.c b/src/fs/fs.c index 8396fc18f..2d080bfa6 100644 --- a/src/fs/fs.c +++ b/src/fs/fs.c | |||
@@ -97,7 +97,7 @@ GNUNET_FS_stop (struct GNUNET_FS_Handle *h) | |||
97 | { | 97 | { |
98 | // FIXME: serialize state!? (or is it always serialized???) | 98 | // FIXME: serialize state!? (or is it always serialized???) |
99 | // FIXME: terminate receive-loop with client | 99 | // FIXME: terminate receive-loop with client |
100 | GNUNET_CLIENT_disconnect (h->client); | 100 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
101 | GNUNET_free (h->client_name); | 101 | GNUNET_free (h->client_name); |
102 | GNUNET_free (h); | 102 | GNUNET_free (h); |
103 | } | 103 | } |
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 7e5081f6e..12d6ff0b6 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -394,7 +394,7 @@ process_result_with_request (void *cls, | |||
394 | GNUNET_CLIENT_notify_transmit_ready_cancel (dc->th); | 394 | GNUNET_CLIENT_notify_transmit_ready_cancel (dc->th); |
395 | dc->th = NULL; | 395 | dc->th = NULL; |
396 | } | 396 | } |
397 | GNUNET_CLIENT_disconnect (dc->client); | 397 | GNUNET_CLIENT_disconnect (dc->client, GNUNET_NO); |
398 | dc->client = NULL; | 398 | dc->client = NULL; |
399 | return GNUNET_NO; | 399 | return GNUNET_NO; |
400 | } | 400 | } |
@@ -460,7 +460,7 @@ process_result_with_request (void *cls, | |||
460 | GNUNET_CLIENT_notify_transmit_ready_cancel (dc->th); | 460 | GNUNET_CLIENT_notify_transmit_ready_cancel (dc->th); |
461 | dc->th = NULL; | 461 | dc->th = NULL; |
462 | } | 462 | } |
463 | GNUNET_CLIENT_disconnect (dc->client); | 463 | GNUNET_CLIENT_disconnect (dc->client, GNUNET_NO); |
464 | dc->client = NULL; | 464 | dc->client = NULL; |
465 | GNUNET_free (sm); | 465 | GNUNET_free (sm); |
466 | return GNUNET_NO; | 466 | return GNUNET_NO; |
@@ -776,7 +776,7 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc) | |||
776 | GNUNET_CONTAINER_multihashmap_iterate (dc->active, | 776 | GNUNET_CONTAINER_multihashmap_iterate (dc->active, |
777 | &retry_entry, | 777 | &retry_entry, |
778 | dc); | 778 | dc); |
779 | GNUNET_CLIENT_disconnect (dc->client); | 779 | GNUNET_CLIENT_disconnect (dc->client, GNUNET_NO); |
780 | dc->client = NULL; | 780 | dc->client = NULL; |
781 | } | 781 | } |
782 | dc->task | 782 | dc->task |
@@ -879,7 +879,7 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, | |||
879 | GNUNET_CONTAINER_meta_data_destroy (dc->meta); | 879 | GNUNET_CONTAINER_meta_data_destroy (dc->meta); |
880 | GNUNET_FS_uri_destroy (dc->uri); | 880 | GNUNET_FS_uri_destroy (dc->uri); |
881 | GNUNET_free (dc->filename); | 881 | GNUNET_free (dc->filename); |
882 | GNUNET_CLIENT_disconnect (dc->client); | 882 | GNUNET_CLIENT_disconnect (dc->client, GNUNET_NO); |
883 | GNUNET_free (dc); | 883 | GNUNET_free (dc); |
884 | return NULL; | 884 | return NULL; |
885 | } | 885 | } |
@@ -960,7 +960,7 @@ GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, | |||
960 | dc->th = NULL; | 960 | dc->th = NULL; |
961 | } | 961 | } |
962 | if (NULL != dc->client) | 962 | if (NULL != dc->client) |
963 | GNUNET_CLIENT_disconnect (dc->client); | 963 | GNUNET_CLIENT_disconnect (dc->client, GNUNET_NO); |
964 | GNUNET_CONTAINER_multihashmap_iterate (dc->active, | 964 | GNUNET_CONTAINER_multihashmap_iterate (dc->active, |
965 | &free_entry, | 965 | &free_entry, |
966 | NULL); | 966 | NULL); |
diff --git a/src/fs/fs_list_indexed.c b/src/fs/fs_list_indexed.c index d182f9aa4..775affbc3 100644 --- a/src/fs/fs_list_indexed.c +++ b/src/fs/fs_list_indexed.c | |||
@@ -94,7 +94,7 @@ handle_index_info (void *cls, | |||
94 | gic->cont, | 94 | gic->cont, |
95 | gic->cont_cls, | 95 | gic->cont_cls, |
96 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 96 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
97 | GNUNET_CLIENT_disconnect (gic->client); | 97 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); |
98 | GNUNET_free (gic); | 98 | GNUNET_free (gic); |
99 | return; | 99 | return; |
100 | } | 100 | } |
@@ -105,7 +105,7 @@ handle_index_info (void *cls, | |||
105 | gic->cont, | 105 | gic->cont, |
106 | gic->cont_cls, | 106 | gic->cont_cls, |
107 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 107 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
108 | GNUNET_CLIENT_disconnect (gic->client); | 108 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); |
109 | GNUNET_free (gic); | 109 | GNUNET_free (gic); |
110 | return; | 110 | return; |
111 | } | 111 | } |
@@ -125,7 +125,7 @@ handle_index_info (void *cls, | |||
125 | gic->cont, | 125 | gic->cont, |
126 | gic->cont_cls, | 126 | gic->cont_cls, |
127 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 127 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
128 | GNUNET_CLIENT_disconnect (gic->client); | 128 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); |
129 | GNUNET_free (gic); | 129 | GNUNET_free (gic); |
130 | return; | 130 | return; |
131 | } | 131 | } |
@@ -138,7 +138,7 @@ handle_index_info (void *cls, | |||
138 | gic->cont, | 138 | gic->cont, |
139 | gic->cont_cls, | 139 | gic->cont_cls, |
140 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 140 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
141 | GNUNET_CLIENT_disconnect (gic->client); | 141 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); |
142 | GNUNET_free (gic); | 142 | GNUNET_free (gic); |
143 | return; | 143 | return; |
144 | } | 144 | } |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index df566b917..db95a6100 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -664,7 +664,7 @@ process_index_start_response (void *cls, | |||
664 | const char *emsg; | 664 | const char *emsg; |
665 | uint16_t msize; | 665 | uint16_t msize; |
666 | 666 | ||
667 | GNUNET_CLIENT_disconnect (sc->client); | 667 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); |
668 | sc->client = NULL; | 668 | sc->client = NULL; |
669 | p = sc->fi_pos; | 669 | p = sc->fi_pos; |
670 | if (msg == NULL) | 670 | if (msg == NULL) |
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 90a28052f..8d9050051 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c | |||
@@ -715,7 +715,7 @@ try_reconnect (struct GNUNET_FS_SearchContext *sc) | |||
715 | { | 715 | { |
716 | if (NULL != sc->client) | 716 | if (NULL != sc->client) |
717 | { | 717 | { |
718 | GNUNET_CLIENT_disconnect (sc->client); | 718 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); |
719 | sc->client = NULL; | 719 | sc->client = NULL; |
720 | } | 720 | } |
721 | sc->task | 721 | sc->task |
@@ -858,7 +858,7 @@ GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc) | |||
858 | sc->task); | 858 | sc->task); |
859 | sc->task = GNUNET_SCHEDULER_NO_TASK; | 859 | sc->task = GNUNET_SCHEDULER_NO_TASK; |
860 | if (NULL != sc->client) | 860 | if (NULL != sc->client) |
861 | GNUNET_CLIENT_disconnect (sc->client); | 861 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); |
862 | sc->client = NULL; | 862 | sc->client = NULL; |
863 | // FIXME: make persistent! | 863 | // FIXME: make persistent! |
864 | // FIXME: should this freeze all active probes? | 864 | // FIXME: should this freeze all active probes? |
@@ -967,7 +967,7 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc) | |||
967 | GNUNET_SCHEDULER_cancel (sc->h->sched, | 967 | GNUNET_SCHEDULER_cancel (sc->h->sched, |
968 | sc->task); | 968 | sc->task); |
969 | if (NULL != sc->client) | 969 | if (NULL != sc->client) |
970 | GNUNET_CLIENT_disconnect (sc->client); | 970 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); |
971 | GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); | 971 | GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); |
972 | for (i=0;i<sc->uri->data.ksk.keywordCount;i++) | 972 | for (i=0;i<sc->uri->data.ksk.keywordCount;i++) |
973 | GNUNET_CONTAINER_multihashmap_destroy (sc->requests[i].results); | 973 | GNUNET_CONTAINER_multihashmap_destroy (sc->requests[i].results); |
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index fc4012464..5d1e7c8f0 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -284,7 +284,7 @@ process_fs_response (void *cls, | |||
284 | { | 284 | { |
285 | struct GNUNET_FS_UnindexContext *uc = cls; | 285 | struct GNUNET_FS_UnindexContext *uc = cls; |
286 | 286 | ||
287 | GNUNET_CLIENT_disconnect (uc->client); | 287 | GNUNET_CLIENT_disconnect (uc->client, GNUNET_NO); |
288 | uc->client = NULL; | 288 | uc->client = NULL; |
289 | if (uc->state != UNINDEX_STATE_FS_NOTIFY) | 289 | if (uc->state != UNINDEX_STATE_FS_NOTIFY) |
290 | { | 290 | { |
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h index 0b06d45d0..21487eb04 100644 --- a/src/include/gnunet_client_lib.h +++ b/src/include/gnunet_client_lib.h | |||
@@ -75,19 +75,24 @@ GNUNET_CLIENT_ignore_shutdown (struct GNUNET_CLIENT_Connection *h, | |||
75 | int do_ignore); | 75 | int do_ignore); |
76 | 76 | ||
77 | 77 | ||
78 | |||
78 | /** | 79 | /** |
79 | * Destroy connection with the service. This will automatically | 80 | * Destroy connection with the service. This will automatically |
80 | * cancel any pending "receive" request (however, the handler will | 81 | * cancel any pending "receive" request (however, the handler will |
81 | * *NOT* be called, not even with a NULL message). Any pending | 82 | * *NOT* be called, not even with a NULL message). Any pending |
82 | * transmission request will also be cancelled UNLESS the callback for | 83 | * transmission request will also be cancelled UNLESS the callback for |
83 | * the transmission request has already been called, in which case the | 84 | * the transmission request has already been called, in which case the |
84 | * transmission is guaranteed to complete before the socket is fully | 85 | * transmission 'finish_pending_write' argument determines whether or |
85 | * destroyed (unless, of course, there is an error with the server | 86 | * not the write is guaranteed to complete before the socket is fully |
86 | * in which case the message may still be lost). | 87 | * destroyed (unless, of course, there is an error with the server in |
88 | * which case the message may still be lost). | ||
87 | * | 89 | * |
88 | * @param sock handle to the service connection | 90 | * @param sock handle to the service connection |
91 | * @param finish_pending_write should a transmission already passed to the | ||
92 | * handle be completed? | ||
89 | */ | 93 | */ |
90 | void GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock); | 94 | void GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock, |
95 | int finish_pending_write); | ||
91 | 96 | ||
92 | /** | 97 | /** |
93 | * Type of a function to call when we receive a message | 98 | * Type of a function to call when we receive a message |
diff --git a/src/include/gnunet_connection_lib.h b/src/include/gnunet_connection_lib.h index 570431165..0f6ae21e3 100644 --- a/src/include/gnunet_connection_lib.h +++ b/src/include/gnunet_connection_lib.h | |||
@@ -197,15 +197,23 @@ int GNUNET_CONNECTION_get_address (struct | |||
197 | *sock, void **addr, | 197 | *sock, void **addr, |
198 | size_t * addrlen); | 198 | size_t * addrlen); |
199 | 199 | ||
200 | |||
200 | /** | 201 | /** |
201 | * Close the socket and free associated resources. Pending | 202 | * Close the socket and free associated resources. Pending |
202 | * transmissions are simply dropped. A pending receive call will be | 203 | * transmissions may be completed or dropped depending on the |
203 | * called with an error code of "EPIPE". | 204 | * arguments. If a receive call is pending and should |
205 | * NOT be completed, 'GNUNET_CONNECTION_receive_cancel' | ||
206 | * should be called explicitly first. | ||
204 | * | 207 | * |
205 | * @param sock socket to destroy | 208 | * @param sock socket to destroy |
209 | * @param finish_pending_write should pending writes be completed or aborted? | ||
210 | * (this applies to transmissions where the data has already been | ||
211 | * read from the application; all other transmissions should be | ||
212 | * aborted using 'GNUNET_CONNECTION_notify_transmit_ready_cancel'). | ||
206 | */ | 213 | */ |
207 | void GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle | 214 | void |
208 | *sock); | 215 | GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock, |
216 | int finish_pending_write); | ||
209 | 217 | ||
210 | 218 | ||
211 | /** | 219 | /** |
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 5531ede97..2a7c990e4 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -56,7 +56,7 @@ copy_and_free (void *cls, size_t size, void *buf) | |||
56 | ntohs (msg->type), "peerinfo"); | 56 | ntohs (msg->type), "peerinfo"); |
57 | #endif | 57 | #endif |
58 | GNUNET_free (msg); | 58 | GNUNET_free (msg); |
59 | GNUNET_CLIENT_disconnect (cc->client); | 59 | GNUNET_CLIENT_disconnect (cc->client, GNUNET_NO); |
60 | GNUNET_free (cc); | 60 | GNUNET_free (cc); |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
@@ -64,7 +64,7 @@ copy_and_free (void *cls, size_t size, void *buf) | |||
64 | GNUNET_assert (size >= msize); | 64 | GNUNET_assert (size >= msize); |
65 | memcpy (buf, msg, msize); | 65 | memcpy (buf, msg, msize); |
66 | GNUNET_free (msg); | 66 | GNUNET_free (msg); |
67 | GNUNET_CLIENT_disconnect (cc->client); | 67 | GNUNET_CLIENT_disconnect (cc->client, GNUNET_YES); |
68 | GNUNET_free (cc); | 68 | GNUNET_free (cc); |
69 | return msize; | 69 | return msize; |
70 | } | 70 | } |
@@ -175,7 +175,7 @@ info_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
175 | _("Failed to receive response from `%s' service.\n"), | 175 | _("Failed to receive response from `%s' service.\n"), |
176 | "peerinfo"); | 176 | "peerinfo"); |
177 | ic->callback (ic->callback_cls, NULL, NULL, 1); | 177 | ic->callback (ic->callback_cls, NULL, NULL, 1); |
178 | GNUNET_CLIENT_disconnect (ic->client); | 178 | GNUNET_CLIENT_disconnect (ic->client, GNUNET_NO); |
179 | GNUNET_free (ic); | 179 | GNUNET_free (ic); |
180 | return; | 180 | return; |
181 | } | 181 | } |
@@ -186,7 +186,7 @@ info_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
186 | "Received end of list of peers from peerinfo database\n"); | 186 | "Received end of list of peers from peerinfo database\n"); |
187 | #endif | 187 | #endif |
188 | ic->callback (ic->callback_cls, NULL, NULL, 0); | 188 | ic->callback (ic->callback_cls, NULL, NULL, 0); |
189 | GNUNET_CLIENT_disconnect (ic->client); | 189 | GNUNET_CLIENT_disconnect (ic->client, GNUNET_NO); |
190 | GNUNET_free (ic); | 190 | GNUNET_free (ic); |
191 | return; | 191 | return; |
192 | } | 192 | } |
@@ -196,7 +196,7 @@ info_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
196 | { | 196 | { |
197 | GNUNET_break (0); | 197 | GNUNET_break (0); |
198 | ic->callback (ic->callback_cls, NULL, NULL, 2); | 198 | ic->callback (ic->callback_cls, NULL, NULL, 2); |
199 | GNUNET_CLIENT_disconnect (ic->client); | 199 | GNUNET_CLIENT_disconnect (ic->client, GNUNET_NO); |
200 | GNUNET_free (ic); | 200 | GNUNET_free (ic); |
201 | return; | 201 | return; |
202 | } | 202 | } |
@@ -209,7 +209,7 @@ info_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
209 | { | 209 | { |
210 | GNUNET_break (0); | 210 | GNUNET_break (0); |
211 | ic->callback (ic->callback_cls, NULL, NULL, 2); | 211 | ic->callback (ic->callback_cls, NULL, NULL, 2); |
212 | GNUNET_CLIENT_disconnect (ic->client); | 212 | GNUNET_CLIENT_disconnect (ic->client, GNUNET_NO); |
213 | GNUNET_free (ic); | 213 | GNUNET_free (ic); |
214 | return; | 214 | return; |
215 | } | 215 | } |
@@ -307,7 +307,7 @@ GNUNET_PEERINFO_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
307 | ihc)) | 307 | ihc)) |
308 | { | 308 | { |
309 | GNUNET_break (0); | 309 | GNUNET_break (0); |
310 | GNUNET_CLIENT_disconnect (ihc->client); | 310 | GNUNET_CLIENT_disconnect (ihc->client, GNUNET_NO); |
311 | GNUNET_free (ihc); | 311 | GNUNET_free (ihc); |
312 | return NULL; | 312 | return NULL; |
313 | } | 313 | } |
@@ -323,7 +323,7 @@ GNUNET_PEERINFO_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
323 | void | 323 | void |
324 | GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic) | 324 | GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic) |
325 | { | 325 | { |
326 | GNUNET_CLIENT_disconnect (ic->client); | 326 | GNUNET_CLIENT_disconnect (ic->client, GNUNET_NO); |
327 | GNUNET_free (ic); | 327 | GNUNET_free (ic); |
328 | } | 328 | } |
329 | 329 | ||
@@ -406,7 +406,7 @@ process_notification (void *cls, | |||
406 | 406 | ||
407 | if (msg == NULL) | 407 | if (msg == NULL) |
408 | { | 408 | { |
409 | GNUNET_CLIENT_disconnect (nc->client); | 409 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); |
410 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); | 410 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); |
411 | request_notifications (nc); | 411 | request_notifications (nc); |
412 | return; | 412 | return; |
@@ -416,7 +416,7 @@ process_notification (void *cls, | |||
416 | (ntohs (msg->type) != GNUNET_MESSAGE_TYPE_PEERINFO_INFO)) | 416 | (ntohs (msg->type) != GNUNET_MESSAGE_TYPE_PEERINFO_INFO)) |
417 | { | 417 | { |
418 | GNUNET_break (0); | 418 | GNUNET_break (0); |
419 | GNUNET_CLIENT_disconnect (nc->client); | 419 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); |
420 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); | 420 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); |
421 | request_notifications (nc); | 421 | request_notifications (nc); |
422 | return; | 422 | return; |
@@ -429,7 +429,7 @@ process_notification (void *cls, | |||
429 | if (ms != sizeof (struct InfoMessage) + GNUNET_HELLO_size (hello)) | 429 | if (ms != sizeof (struct InfoMessage) + GNUNET_HELLO_size (hello)) |
430 | { | 430 | { |
431 | GNUNET_break (0); | 431 | GNUNET_break (0); |
432 | GNUNET_CLIENT_disconnect (nc->client); | 432 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); |
433 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); | 433 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); |
434 | request_notifications (nc); | 434 | request_notifications (nc); |
435 | return; | 435 | return; |
@@ -480,7 +480,7 @@ transmit_notify_request (void *cls, | |||
480 | nc->init = NULL; | 480 | nc->init = NULL; |
481 | if (buf == NULL) | 481 | if (buf == NULL) |
482 | { | 482 | { |
483 | GNUNET_CLIENT_disconnect (nc->client); | 483 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); |
484 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); | 484 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); |
485 | request_notifications (nc); | 485 | request_notifications (nc); |
486 | return 0; | 486 | return 0; |
@@ -564,7 +564,7 @@ GNUNET_PEERINFO_notify_cancel (struct GNUNET_PEERINFO_NotifyContext *nc) | |||
564 | GNUNET_CLIENT_notify_transmit_ready_cancel (nc->init); | 564 | GNUNET_CLIENT_notify_transmit_ready_cancel (nc->init); |
565 | nc->init = NULL; | 565 | nc->init = NULL; |
566 | } | 566 | } |
567 | GNUNET_CLIENT_disconnect (nc->client); | 567 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); |
568 | GNUNET_free (nc); | 568 | GNUNET_free (nc); |
569 | } | 569 | } |
570 | 570 | ||
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index e9ebe7fa6..c8a341b0c 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c | |||
@@ -304,7 +304,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg) | |||
304 | { | 304 | { |
305 | if (NULL != h->client) | 305 | if (NULL != h->client) |
306 | { | 306 | { |
307 | GNUNET_CLIENT_disconnect (h->client); | 307 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
308 | h->client = NULL; | 308 | h->client = NULL; |
309 | } | 309 | } |
310 | #if DEBUG_STATISTICS | 310 | #if DEBUG_STATISTICS |
@@ -342,7 +342,7 @@ receive_stats (void *cls, const struct GNUNET_MessageHeader *msg) | |||
342 | } | 342 | } |
343 | if (NULL != h->client) | 343 | if (NULL != h->client) |
344 | { | 344 | { |
345 | GNUNET_CLIENT_disconnect (h->client); | 345 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
346 | h->client = NULL; | 346 | h->client = NULL; |
347 | } | 347 | } |
348 | finish (h, GNUNET_SYSERR); | 348 | finish (h, GNUNET_SYSERR); |
@@ -579,7 +579,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, | |||
579 | } | 579 | } |
580 | if (h->client != NULL) | 580 | if (h->client != NULL) |
581 | { | 581 | { |
582 | GNUNET_CLIENT_disconnect (h->client); | 582 | GNUNET_CLIENT_disconnect (h->client, GNUNET_YES); |
583 | h->client = NULL; | 583 | h->client = NULL; |
584 | } | 584 | } |
585 | GNUNET_free (h->subsystem); | 585 | GNUNET_free (h->subsystem); |
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 80eda9935..7889cc715 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -1363,7 +1363,7 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) | |||
1363 | "Disconnecting from transport service for good.\n"); | 1363 | "Disconnecting from transport service for good.\n"); |
1364 | #endif | 1364 | #endif |
1365 | handle->client = NULL; | 1365 | handle->client = NULL; |
1366 | GNUNET_CLIENT_disconnect (client); | 1366 | GNUNET_CLIENT_disconnect (client, GNUNET_NO); |
1367 | } | 1367 | } |
1368 | GNUNET_free (handle); | 1368 | GNUNET_free (handle); |
1369 | } | 1369 | } |
@@ -1408,7 +1408,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1408 | GNUNET_CLIENT_notify_transmit_ready_cancel (h->network_handle); | 1408 | GNUNET_CLIENT_notify_transmit_ready_cancel (h->network_handle); |
1409 | h->network_handle = NULL; | 1409 | h->network_handle = NULL; |
1410 | } | 1410 | } |
1411 | GNUNET_CLIENT_disconnect (h->client); | 1411 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
1412 | h->client = NULL; | 1412 | h->client = NULL; |
1413 | schedule_reconnect (h); | 1413 | schedule_reconnect (h); |
1414 | return; | 1414 | return; |
diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c index d2bc51d47..bf0b37442 100644 --- a/src/transport/transport_api_address_lookup.c +++ b/src/transport/transport_api_address_lookup.c | |||
@@ -30,7 +30,7 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg) | |||
30 | { | 30 | { |
31 | /* timeout */ | 31 | /* timeout */ |
32 | alucb->cb (alucb->cls, NULL); | 32 | alucb->cb (alucb->cls, NULL); |
33 | GNUNET_CLIENT_disconnect (alucb->client); | 33 | GNUNET_CLIENT_disconnect (alucb->client. GNUNET_NO); |
34 | GNUNET_free (alucb); | 34 | GNUNET_free (alucb); |
35 | return; | 35 | return; |
36 | } | 36 | } |
@@ -48,7 +48,7 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg) | |||
48 | /* invalid reply */ | 48 | /* invalid reply */ |
49 | GNUNET_break_op (0); | 49 | GNUNET_break_op (0); |
50 | alucb->cb (alucb->cls, NULL); | 50 | alucb->cb (alucb->cls, NULL); |
51 | GNUNET_CLIENT_disconnect (alucb->client); | 51 | GNUNET_CLIENT_disconnect (alucb->client, GNUNET_NO); |
52 | GNUNET_free (alucb); | 52 | GNUNET_free (alucb); |
53 | return; | 53 | return; |
54 | } | 54 | } |
@@ -65,7 +65,7 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg) | |||
65 | if (address == NULL) | 65 | if (address == NULL) |
66 | { | 66 | { |
67 | /* done! */ | 67 | /* done! */ |
68 | GNUNET_CLIENT_disconnect (alucb->client); | 68 | GNUNET_CLIENT_disconnect (alucb->client, GNUNET_NO); |
69 | GNUNET_free (alucb); | 69 | GNUNET_free (alucb); |
70 | } | 70 | } |
71 | } | 71 | } |
diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c index d33c4123c..c8838f1b6 100644 --- a/src/transport/transport_api_blacklist.c +++ b/src/transport/transport_api_blacklist.c | |||
@@ -243,7 +243,7 @@ request_notifications (struct GNUNET_TRANSPORT_BlacklistNotification *bn); | |||
243 | static void | 243 | static void |
244 | retry_get_notifications (struct GNUNET_TRANSPORT_BlacklistNotification *bn) | 244 | retry_get_notifications (struct GNUNET_TRANSPORT_BlacklistNotification *bn) |
245 | { | 245 | { |
246 | GNUNET_CLIENT_disconnect (bn->client); | 246 | GNUNET_CLIENT_disconnect (bn->client, GNUNET_NO); |
247 | bn->client = GNUNET_CLIENT_connect (bn->sched, "transport", bn->cfg); | 247 | bn->client = GNUNET_CLIENT_connect (bn->sched, "transport", bn->cfg); |
248 | request_notifications (bn); | 248 | request_notifications (bn); |
249 | } | 249 | } |
@@ -379,7 +379,7 @@ GNUNET_TRANSPORT_blacklist_notify_cancel (struct GNUNET_TRANSPORT_BlacklistNotif | |||
379 | { | 379 | { |
380 | if (bn->th != NULL) | 380 | if (bn->th != NULL) |
381 | GNUNET_CLIENT_notify_transmit_ready_cancel (bn->th); | 381 | GNUNET_CLIENT_notify_transmit_ready_cancel (bn->th); |
382 | GNUNET_CLIENT_disconnect (bn->client); | 382 | GNUNET_CLIENT_disconnect (bn->client, GNUNET_NO); |
383 | GNUNET_free (bn); | 383 | GNUNET_free (bn); |
384 | } | 384 | } |
385 | 385 | ||
diff --git a/src/util/client.c b/src/util/client.c index 30c0fcf86..86b36bfbb 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -350,14 +350,18 @@ GNUNET_CLIENT_ignore_shutdown (struct GNUNET_CLIENT_Connection *h, | |||
350 | * *NOT* be called, not even with a NULL message). Any pending | 350 | * *NOT* be called, not even with a NULL message). Any pending |
351 | * transmission request will also be cancelled UNLESS the callback for | 351 | * transmission request will also be cancelled UNLESS the callback for |
352 | * the transmission request has already been called, in which case the | 352 | * the transmission request has already been called, in which case the |
353 | * transmission is guaranteed to complete before the socket is fully | 353 | * transmission 'finish_pending_write' argument determines whether or |
354 | * destroyed (unless, of course, there is an error with the server | 354 | * not the write is guaranteed to complete before the socket is fully |
355 | * in which case the message may still be lost). | 355 | * destroyed (unless, of course, there is an error with the server in |
356 | * which case the message may still be lost). | ||
356 | * | 357 | * |
358 | * @param finish_pending_write should a transmission already passed to the | ||
359 | * handle be completed? | ||
357 | * @param sock handle to the service connection | 360 | * @param sock handle to the service connection |
358 | */ | 361 | */ |
359 | void | 362 | void |
360 | GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock) | 363 | GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock, |
364 | int finish_pending_write) | ||
361 | { | 365 | { |
362 | GNUNET_assert (sock->sock != NULL); | 366 | GNUNET_assert (sock->sock != NULL); |
363 | if (sock->in_receive == GNUNET_YES) | 367 | if (sock->in_receive == GNUNET_YES) |
@@ -365,7 +369,7 @@ GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock) | |||
365 | GNUNET_CONNECTION_receive_cancel (sock->sock); | 369 | GNUNET_CONNECTION_receive_cancel (sock->sock); |
366 | sock->in_receive = GNUNET_NO; | 370 | sock->in_receive = GNUNET_NO; |
367 | } | 371 | } |
368 | GNUNET_CONNECTION_destroy (sock->sock); | 372 | GNUNET_CONNECTION_destroy (sock->sock, finish_pending_write); |
369 | sock->sock = NULL; | 373 | sock->sock = NULL; |
370 | if (sock->tag != NULL) | 374 | if (sock->tag != NULL) |
371 | { | 375 | { |
@@ -551,7 +555,7 @@ write_shutdown (void *cls, size_t size, void *buf) | |||
551 | struct GNUNET_MessageHeader *msg; | 555 | struct GNUNET_MessageHeader *msg; |
552 | struct GNUNET_CLIENT_Connection *sock = cls; | 556 | struct GNUNET_CLIENT_Connection *sock = cls; |
553 | 557 | ||
554 | GNUNET_CLIENT_disconnect (sock); | 558 | GNUNET_CLIENT_disconnect (sock, GNUNET_YES); |
555 | if (size < sizeof (struct GNUNET_MessageHeader)) | 559 | if (size < sizeof (struct GNUNET_MessageHeader)) |
556 | { | 560 | { |
557 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 561 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -627,7 +631,7 @@ confirm_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
627 | { | 631 | { |
628 | service_test_error (conn->sched, conn->test_cb, conn->test_cb_cls); | 632 | service_test_error (conn->sched, conn->test_cb, conn->test_cb_cls); |
629 | } | 633 | } |
630 | GNUNET_CLIENT_disconnect (conn); | 634 | GNUNET_CLIENT_disconnect (conn, GNUNET_NO); |
631 | } | 635 | } |
632 | 636 | ||
633 | 637 | ||
@@ -710,7 +714,7 @@ GNUNET_CLIENT_service_test (struct GNUNET_SCHEDULER_Handle *sched, | |||
710 | _("Failure to transmit request to service `%s'\n"), | 714 | _("Failure to transmit request to service `%s'\n"), |
711 | service); | 715 | service); |
712 | service_test_error (sched, task, task_cls); | 716 | service_test_error (sched, task, task_cls); |
713 | GNUNET_CLIENT_disconnect (conn); | 717 | GNUNET_CLIENT_disconnect (conn, GNUNET_NO); |
714 | return; | 718 | return; |
715 | } | 719 | } |
716 | } | 720 | } |
@@ -806,7 +810,7 @@ client_notify (void *cls, size_t size, void *buf) | |||
806 | return 0; | 810 | return 0; |
807 | } | 811 | } |
808 | /* auto-retry */ | 812 | /* auto-retry */ |
809 | GNUNET_CONNECTION_destroy (th->sock->sock); | 813 | GNUNET_CONNECTION_destroy (th->sock->sock, GNUNET_NO); |
810 | th->sock->sock = do_connect (th->sock->sched, | 814 | th->sock->sock = do_connect (th->sock->sched, |
811 | th->sock->service_name, th->sock->cfg); | 815 | th->sock->service_name, th->sock->cfg); |
812 | GNUNET_assert (NULL != th->sock->sock); | 816 | GNUNET_assert (NULL != th->sock->sock); |
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 693655884..a19821511 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -162,6 +162,7 @@ int | |||
162 | GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) | 162 | GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) |
163 | { | 163 | { |
164 | FILE *altlog; | 164 | FILE *altlog; |
165 | int dirwarn; | ||
165 | 166 | ||
166 | GNUNET_free_non_null (component); | 167 | GNUNET_free_non_null (component); |
167 | GNUNET_asprintf (&component, | 168 | GNUNET_asprintf (&component, |
@@ -171,15 +172,15 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) | |||
171 | min_level = get_type (loglevel); | 172 | min_level = get_type (loglevel); |
172 | if (logfile == NULL) | 173 | if (logfile == NULL) |
173 | return GNUNET_OK; | 174 | return GNUNET_OK; |
174 | if (GNUNET_OK != | 175 | dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (logfile)); |
175 | GNUNET_DISK_directory_create_for_file (logfile)) | ||
176 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
177 | _("Failed to create or access directory for log file `%s'"), | ||
178 | logfile); | ||
179 | altlog = FOPEN (logfile, "a"); | 176 | altlog = FOPEN (logfile, "a"); |
180 | if (altlog == NULL) | 177 | if (altlog == NULL) |
181 | { | 178 | { |
182 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "fopen", logfile); | 179 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "fopen", logfile); |
180 | if (dirwarn) | ||
181 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
182 | _("Failed to create or access directory for log file `%s'\n"), | ||
183 | logfile); | ||
183 | return GNUNET_SYSERR; | 184 | return GNUNET_SYSERR; |
184 | } | 185 | } |
185 | if (GNUNET_stderr != NULL) | 186 | if (GNUNET_stderr != NULL) |
diff --git a/src/util/connection.c b/src/util/connection.c index b1e13a663..c572d02de 100644 --- a/src/util/connection.c +++ b/src/util/connection.c | |||
@@ -916,19 +916,35 @@ GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle *sock) | |||
916 | 916 | ||
917 | /** | 917 | /** |
918 | * Close the socket and free associated resources. Pending | 918 | * Close the socket and free associated resources. Pending |
919 | * transmissions are simply dropped. A pending receive call will be | 919 | * transmissions may be completed or dropped depending on the |
920 | * called with an error code of "EPIPE". | 920 | * arguments. If a receive call is pending and should |
921 | * NOT be completed, 'GNUNET_CONNECTION_receive_cancel' | ||
922 | * should be called explicitly first. | ||
921 | * | 923 | * |
922 | * @param sock socket to destroy | 924 | * @param sock socket to destroy |
925 | * @param finish_pending_write should pending writes be completed or aborted? | ||
926 | * (this applies to transmissions where the data has already been | ||
927 | * read from the application; all other transmissions should be | ||
928 | * aborted using 'GNUNET_CONNECTION_notify_transmit_ready_cancel'). | ||
923 | */ | 929 | */ |
924 | void | 930 | void |
925 | GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock) | 931 | GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock, |
932 | int finish_pending_write) | ||
926 | { | 933 | { |
927 | if ((sock->write_buffer_off == 0) && (sock->dns_active != NULL)) | 934 | if ((sock->write_buffer_off == 0) && (sock->dns_active != NULL)) |
928 | { | 935 | { |
929 | GNUNET_RESOLVER_request_cancel (sock->dns_active); | 936 | GNUNET_RESOLVER_request_cancel (sock->dns_active); |
930 | sock->dns_active = NULL; | 937 | sock->dns_active = NULL; |
931 | } | 938 | } |
939 | if (GNUNET_NO == finish_pending_write) | ||
940 | { | ||
941 | if (sock->write_task != GNUNET_SCHEDULER_NO_TASK) | ||
942 | { | ||
943 | GNUNET_SCHEDULER_cancel (sock->sched, | ||
944 | sock->write_task); | ||
945 | sock->write_task = GNUNET_SCHEDULER_NO_TASK; | ||
946 | } | ||
947 | } | ||
932 | GNUNET_assert (sock->sched != NULL); | 948 | GNUNET_assert (sock->sched != NULL); |
933 | GNUNET_SCHEDULER_add_now (sock->sched, | 949 | GNUNET_SCHEDULER_add_now (sock->sched, |
934 | &destroy_continuation, sock); | 950 | &destroy_continuation, sock); |
@@ -1316,6 +1332,20 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1316 | GNUNET_assert (sock->write_task != GNUNET_SCHEDULER_NO_TASK); | 1332 | GNUNET_assert (sock->write_task != GNUNET_SCHEDULER_NO_TASK); |
1317 | sock->write_task = GNUNET_SCHEDULER_NO_TASK; | 1333 | sock->write_task = GNUNET_SCHEDULER_NO_TASK; |
1318 | GNUNET_assert (sock->nth.timeout_task == GNUNET_SCHEDULER_NO_TASK); | 1334 | GNUNET_assert (sock->nth.timeout_task == GNUNET_SCHEDULER_NO_TASK); |
1335 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | ||
1336 | { | ||
1337 | if (sock->ignore_shutdown == GNUNET_YES) | ||
1338 | goto SCHEDULE_WRITE; /* ignore shutdown, go again immediately */ | ||
1339 | #if DEBUG_CONNECTION | ||
1340 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1341 | "Transmit to `%s' fails, shutdown happened (%p).\n", | ||
1342 | GNUNET_a2s (sock->addr, sock->addrlen), sock); | ||
1343 | #endif | ||
1344 | notify = sock->nth.notify_ready; | ||
1345 | sock->nth.notify_ready = NULL; | ||
1346 | notify (sock->nth.notify_ready_cls, 0, NULL); | ||
1347 | return; | ||
1348 | } | ||
1319 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) | 1349 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) |
1320 | { | 1350 | { |
1321 | #if DEBUG_CONNECTION | 1351 | #if DEBUG_CONNECTION |
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index f04db13c3..ecd3789f4 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -231,7 +231,7 @@ handle_address_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
231 | _("Timeout trying to resolve hostname `%s'.\n"), | 231 | _("Timeout trying to resolve hostname `%s'.\n"), |
232 | rh->hostname); | 232 | rh->hostname); |
233 | rh->addr_callback (rh->cls, NULL, 0); | 233 | rh->addr_callback (rh->cls, NULL, 0); |
234 | GNUNET_CLIENT_disconnect (rh->client); | 234 | GNUNET_CLIENT_disconnect (rh->client, GNUNET_NO); |
235 | GNUNET_free (rh); | 235 | GNUNET_free (rh); |
236 | return; | 236 | return; |
237 | } | 237 | } |
@@ -239,7 +239,7 @@ handle_address_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
239 | { | 239 | { |
240 | GNUNET_break (0); | 240 | GNUNET_break (0); |
241 | rh->addr_callback (rh->cls, NULL, 0); | 241 | rh->addr_callback (rh->cls, NULL, 0); |
242 | GNUNET_CLIENT_disconnect (rh->client); | 242 | GNUNET_CLIENT_disconnect (rh->client, GNUNET_NO); |
243 | GNUNET_free (rh); | 243 | GNUNET_free (rh); |
244 | return; | 244 | return; |
245 | } | 245 | } |
@@ -253,7 +253,7 @@ handle_address_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
253 | rh->hostname); | 253 | rh->hostname); |
254 | #endif | 254 | #endif |
255 | rh->addr_callback (rh->cls, NULL, 0); | 255 | rh->addr_callback (rh->cls, NULL, 0); |
256 | GNUNET_CLIENT_disconnect (rh->client); | 256 | GNUNET_CLIENT_disconnect (rh->client, GNUNET_NO); |
257 | GNUNET_free (rh); | 257 | GNUNET_free (rh); |
258 | return; | 258 | return; |
259 | } | 259 | } |
@@ -263,7 +263,7 @@ handle_address_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
263 | { | 263 | { |
264 | GNUNET_break (0); | 264 | GNUNET_break (0); |
265 | rh->addr_callback (rh->cls, NULL, 0); | 265 | rh->addr_callback (rh->cls, NULL, 0); |
266 | GNUNET_CLIENT_disconnect (rh->client); | 266 | GNUNET_CLIENT_disconnect (rh->client, GNUNET_NO); |
267 | GNUNET_free (rh); | 267 | GNUNET_free (rh); |
268 | return; | 268 | return; |
269 | } | 269 | } |
@@ -488,7 +488,7 @@ GNUNET_RESOLVER_ip_get (struct GNUNET_SCHEDULER_Handle *sched, | |||
488 | &handle_address_response, rh)) | 488 | &handle_address_response, rh)) |
489 | { | 489 | { |
490 | GNUNET_free (rh); | 490 | GNUNET_free (rh); |
491 | GNUNET_CLIENT_disconnect (client); | 491 | GNUNET_CLIENT_disconnect (client, GNUNET_NO); |
492 | return NULL; | 492 | return NULL; |
493 | } | 493 | } |
494 | return rh; | 494 | return rh; |
@@ -514,7 +514,7 @@ handle_hostname_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
514 | _("Timeout trying to resolve IP address `%s'.\n"), | 514 | _("Timeout trying to resolve IP address `%s'.\n"), |
515 | GNUNET_a2s ((const void*) &rh[1], rh->salen)); | 515 | GNUNET_a2s ((const void*) &rh[1], rh->salen)); |
516 | rh->name_callback (rh->cls, NULL); | 516 | rh->name_callback (rh->cls, NULL); |
517 | GNUNET_CLIENT_disconnect (rh->client); | 517 | GNUNET_CLIENT_disconnect (rh->client, GNUNET_NO); |
518 | GNUNET_free (rh); | 518 | GNUNET_free (rh); |
519 | return; | 519 | return; |
520 | } | 520 | } |
@@ -527,7 +527,7 @@ handle_hostname_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
527 | GNUNET_a2s ((const void*) &rh[1], rh->salen)); | 527 | GNUNET_a2s ((const void*) &rh[1], rh->salen)); |
528 | #endif | 528 | #endif |
529 | rh->name_callback (rh->cls, NULL); | 529 | rh->name_callback (rh->cls, NULL); |
530 | GNUNET_CLIENT_disconnect (rh->client); | 530 | GNUNET_CLIENT_disconnect (rh->client, GNUNET_NO); |
531 | GNUNET_free (rh); | 531 | GNUNET_free (rh); |
532 | return; | 532 | return; |
533 | } | 533 | } |
@@ -536,7 +536,7 @@ handle_hostname_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
536 | { | 536 | { |
537 | GNUNET_break (0); | 537 | GNUNET_break (0); |
538 | rh->name_callback (rh->cls, NULL); | 538 | rh->name_callback (rh->cls, NULL); |
539 | GNUNET_CLIENT_disconnect (rh->client); | 539 | GNUNET_CLIENT_disconnect (rh->client, GNUNET_NO); |
540 | GNUNET_free (rh); | 540 | GNUNET_free (rh); |
541 | return; | 541 | return; |
542 | } | 542 | } |
@@ -659,7 +659,7 @@ GNUNET_RESOLVER_hostname_get (struct GNUNET_SCHEDULER_Handle *sched, | |||
659 | GNUNET_YES, | 659 | GNUNET_YES, |
660 | &handle_hostname_response, rh)) | 660 | &handle_hostname_response, rh)) |
661 | { | 661 | { |
662 | GNUNET_CLIENT_disconnect (client); | 662 | GNUNET_CLIENT_disconnect (client, GNUNET_NO); |
663 | GNUNET_free (rh); | 663 | GNUNET_free (rh); |
664 | return NULL; | 664 | return NULL; |
665 | } | 665 | } |
@@ -717,7 +717,7 @@ void | |||
717 | GNUNET_RESOLVER_request_cancel (struct GNUNET_RESOLVER_RequestHandle *h) | 717 | GNUNET_RESOLVER_request_cancel (struct GNUNET_RESOLVER_RequestHandle *h) |
718 | { | 718 | { |
719 | if (h->client != NULL) | 719 | if (h->client != NULL) |
720 | GNUNET_CLIENT_disconnect (h->client); | 720 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
721 | if (h->task != GNUNET_SCHEDULER_NO_TASK) | 721 | if (h->task != GNUNET_SCHEDULER_NO_TASK) |
722 | GNUNET_SCHEDULER_cancel (h->sched, h->task); | 722 | GNUNET_SCHEDULER_cancel (h->sched, h->task); |
723 | GNUNET_free (h); | 723 | GNUNET_free (h); |
diff --git a/src/util/server.c b/src/util/server.c index 223791151..5fda7ae81 100644 --- a/src/util/server.c +++ b/src/util/server.c | |||
@@ -937,7 +937,7 @@ sock_check (void *cls) | |||
937 | static void | 937 | static void |
938 | sock_destroy (void *cls) | 938 | sock_destroy (void *cls) |
939 | { | 939 | { |
940 | GNUNET_CONNECTION_destroy (cls); | 940 | GNUNET_CONNECTION_destroy (cls, GNUNET_NO); |
941 | } | 941 | } |
942 | 942 | ||
943 | 943 | ||
diff --git a/src/util/test_client.c b/src/util/test_client.c index aa8b93a82..d51424aea 100644 --- a/src/util/test_client.c +++ b/src/util/test_client.c | |||
@@ -113,7 +113,7 @@ recv_bounce (void *cls, const struct GNUNET_MessageHeader *got) | |||
113 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); | 113 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); |
114 | GNUNET_assert (0 == | 114 | GNUNET_assert (0 == |
115 | memcmp (got, &msg, sizeof (struct GNUNET_MessageHeader))); | 115 | memcmp (got, &msg, sizeof (struct GNUNET_MessageHeader))); |
116 | GNUNET_CLIENT_disconnect (client); | 116 | GNUNET_CLIENT_disconnect (client, GNUNET_YES); |
117 | client = NULL; | 117 | client = NULL; |
118 | GNUNET_SERVER_destroy (server); | 118 | GNUNET_SERVER_destroy (server); |
119 | server = NULL; | 119 | server = NULL; |
diff --git a/src/util/test_connection.c b/src/util/test_connection.c index 07b5e843d..bec3a5619 100644 --- a/src/util/test_connection.c +++ b/src/util/test_connection.c | |||
@@ -107,7 +107,7 @@ receive_check (void *cls, | |||
107 | "Receive closes accepted socket\n"); | 107 | "Receive closes accepted socket\n"); |
108 | #endif | 108 | #endif |
109 | *ok = 0; | 109 | *ok = 0; |
110 | GNUNET_CONNECTION_destroy (asock); | 110 | GNUNET_CONNECTION_destroy (asock, GNUNET_YES); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
@@ -125,7 +125,7 @@ run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
125 | #if VERBOSE | 125 | #if VERBOSE |
126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test destroys listen socket\n"); | 126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test destroys listen socket\n"); |
127 | #endif | 127 | #endif |
128 | GNUNET_CONNECTION_destroy (lsock); | 128 | GNUNET_CONNECTION_destroy (lsock, GNUNET_YES); |
129 | #if VERBOSE | 129 | #if VERBOSE |
130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
131 | "Test asks to receive on accepted socket\n"); | 131 | "Test asks to receive on accepted socket\n"); |
@@ -149,7 +149,7 @@ make_hello (void *cls, size_t size, void *buf) | |||
149 | #if VERBOSE | 149 | #if VERBOSE |
150 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test destroys client socket\n"); | 150 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test destroys client socket\n"); |
151 | #endif | 151 | #endif |
152 | GNUNET_CONNECTION_destroy (csock); | 152 | GNUNET_CONNECTION_destroy (csock, GNUNET_YES); |
153 | return 12; | 153 | return 12; |
154 | } | 154 | } |
155 | 155 | ||
diff --git a/src/util/test_connection_addressing.c b/src/util/test_connection_addressing.c index 8f76b8e74..e900e2ed7 100644 --- a/src/util/test_connection_addressing.c +++ b/src/util/test_connection_addressing.c | |||
@@ -102,7 +102,7 @@ receive_check (void *cls, | |||
102 | else | 102 | else |
103 | { | 103 | { |
104 | *ok = 0; | 104 | *ok = 0; |
105 | GNUNET_CONNECTION_destroy (asock); | 105 | GNUNET_CONNECTION_destroy (asock, GNUNET_YES); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
@@ -132,7 +132,7 @@ run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
132 | expect.sin_addr.s_addr = htonl (INADDR_LOOPBACK); | 132 | expect.sin_addr.s_addr = htonl (INADDR_LOOPBACK); |
133 | GNUNET_assert (0 == memcmp (&expect, v4, alen)); | 133 | GNUNET_assert (0 == memcmp (&expect, v4, alen)); |
134 | GNUNET_free (addr); | 134 | GNUNET_free (addr); |
135 | GNUNET_CONNECTION_destroy (lsock); | 135 | GNUNET_CONNECTION_destroy (lsock, GNUNET_YES); |
136 | GNUNET_CONNECTION_receive (asock, | 136 | GNUNET_CONNECTION_receive (asock, |
137 | 1024, | 137 | 1024, |
138 | GNUNET_TIME_relative_multiply | 138 | GNUNET_TIME_relative_multiply |
@@ -172,7 +172,7 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
172 | 12, | 172 | 12, |
173 | GNUNET_TIME_UNIT_SECONDS, | 173 | GNUNET_TIME_UNIT_SECONDS, |
174 | &make_hello, NULL)); | 174 | &make_hello, NULL)); |
175 | GNUNET_CONNECTION_destroy (csock); | 175 | GNUNET_CONNECTION_destroy (csock, GNUNET_YES); |
176 | GNUNET_SCHEDULER_add_read_net (tc->sched, | 176 | GNUNET_SCHEDULER_add_read_net (tc->sched, |
177 | GNUNET_TIME_UNIT_FOREVER_REL, | 177 | GNUNET_TIME_UNIT_FOREVER_REL, |
178 | ls, &run_accept, cls); | 178 | ls, &run_accept, cls); |
diff --git a/src/util/test_connection_receive_cancel.c b/src/util/test_connection_receive_cancel.c index 9b00bbdf7..f3bd40438 100644 --- a/src/util/test_connection_receive_cancel.c +++ b/src/util/test_connection_receive_cancel.c | |||
@@ -94,7 +94,7 @@ run_accept_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
94 | NULL, NULL, ls, 1024); | 94 | NULL, NULL, ls, 1024); |
95 | GNUNET_assert (asock != NULL); | 95 | GNUNET_assert (asock != NULL); |
96 | GNUNET_assert (GNUNET_YES == GNUNET_CONNECTION_check (asock)); | 96 | GNUNET_assert (GNUNET_YES == GNUNET_CONNECTION_check (asock)); |
97 | GNUNET_CONNECTION_destroy (lsock); | 97 | GNUNET_CONNECTION_destroy (lsock, GNUNET_YES); |
98 | GNUNET_CONNECTION_receive (asock, | 98 | GNUNET_CONNECTION_receive (asock, |
99 | 1024, | 99 | 1024, |
100 | GNUNET_TIME_relative_multiply | 100 | GNUNET_TIME_relative_multiply |
@@ -108,8 +108,8 @@ receive_cancel_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
108 | { | 108 | { |
109 | int *ok = cls; | 109 | int *ok = cls; |
110 | GNUNET_CONNECTION_receive_cancel (asock); | 110 | GNUNET_CONNECTION_receive_cancel (asock); |
111 | GNUNET_CONNECTION_destroy (csock); | 111 | GNUNET_CONNECTION_destroy (csock, GNUNET_YES); |
112 | GNUNET_CONNECTION_destroy (asock); | 112 | GNUNET_CONNECTION_destroy (asock, GNUNET_YES); |
113 | *ok = 0; | 113 | *ok = 0; |
114 | } | 114 | } |
115 | 115 | ||
diff --git a/src/util/test_connection_timeout.c b/src/util/test_connection_timeout.c index 44609fffe..c1d9c4c4d 100644 --- a/src/util/test_connection_timeout.c +++ b/src/util/test_connection_timeout.c | |||
@@ -83,8 +83,8 @@ send_kilo (void *cls, size_t size, void *buf) | |||
83 | #endif | 83 | #endif |
84 | GNUNET_assert (buf == NULL); | 84 | GNUNET_assert (buf == NULL); |
85 | *ok = 0; | 85 | *ok = 0; |
86 | GNUNET_CONNECTION_destroy (lsock); | 86 | GNUNET_CONNECTION_destroy (lsock, GNUNET_YES); |
87 | GNUNET_CONNECTION_destroy (csock); | 87 | GNUNET_CONNECTION_destroy (csock, GNUNET_YES); |
88 | return 0; | 88 | return 0; |
89 | } | 89 | } |
90 | #if VERBOSE | 90 | #if VERBOSE |
diff --git a/src/util/test_connection_transmit_cancel.c b/src/util/test_connection_transmit_cancel.c index afdca68b5..bb5415d61 100644 --- a/src/util/test_connection_transmit_cancel.c +++ b/src/util/test_connection_transmit_cancel.c | |||
@@ -58,7 +58,7 @@ task_transmit_cancel (void *cls, | |||
58 | GNUNET_TIME_UNIT_MINUTES, | 58 | GNUNET_TIME_UNIT_MINUTES, |
59 | ¬_run, cls); | 59 | ¬_run, cls); |
60 | GNUNET_CONNECTION_notify_transmit_ready_cancel (th); | 60 | GNUNET_CONNECTION_notify_transmit_ready_cancel (th); |
61 | GNUNET_CONNECTION_destroy (csock); | 61 | GNUNET_CONNECTION_destroy (csock, GNUNET_YES); |
62 | *ok = 0; | 62 | *ok = 0; |
63 | } | 63 | } |
64 | 64 | ||
diff --git a/src/util/test_server_disconnect.c b/src/util/test_server_disconnect.c index b10719e73..faaca968d 100644 --- a/src/util/test_server_disconnect.c +++ b/src/util/test_server_disconnect.c | |||
@@ -119,7 +119,7 @@ disconnect_notify (void *cls, const struct GNUNET_MessageHeader *msg) | |||
119 | GNUNET_assert (msg == NULL); | 119 | GNUNET_assert (msg == NULL); |
120 | GNUNET_assert (ok == 7); | 120 | GNUNET_assert (ok == 7); |
121 | ok = 0; | 121 | ok = 0; |
122 | GNUNET_CLIENT_disconnect (client); | 122 | GNUNET_CLIENT_disconnect (client, GNUNET_YES); |
123 | client = NULL; | 123 | client = NULL; |
124 | GNUNET_SERVER_destroy (server); | 124 | GNUNET_SERVER_destroy (server); |
125 | server = NULL; | 125 | server = NULL; |
diff --git a/src/util/test_server_with_client.c b/src/util/test_server_with_client.c index adce0b432..b28b3b69f 100644 --- a/src/util/test_server_with_client.c +++ b/src/util/test_server_with_client.c | |||
@@ -93,7 +93,7 @@ recv_cb (void *cls, | |||
93 | break; | 93 | break; |
94 | case 4: | 94 | case 4: |
95 | ok++; | 95 | ok++; |
96 | GNUNET_CLIENT_disconnect (client); | 96 | GNUNET_CLIENT_disconnect (client, GNUNET_YES); |
97 | GNUNET_SERVER_receive_done (argclient, GNUNET_OK); | 97 | GNUNET_SERVER_receive_done (argclient, GNUNET_OK); |
98 | break; | 98 | break; |
99 | default: | 99 | default: |