diff options
Diffstat (limited to 'src/gns/gns_api.c')
-rw-r--r-- | src/gns/gns_api.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index ff67f0205..3b658da92 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2013, 2016, 2018 GNUnet e.V. | 3 | Copyright (C) 2009-2013, 2016, 2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file gns/gns_api.c | 19 | * @file gns/gns_api.c |
@@ -157,7 +155,7 @@ check_result (void *cls, | |||
157 | size_t mlen = ntohs (lookup_msg->header.size) - sizeof (*lookup_msg); | 155 | size_t mlen = ntohs (lookup_msg->header.size) - sizeof (*lookup_msg); |
158 | uint32_t rd_count = ntohl (lookup_msg->rd_count); | 156 | uint32_t rd_count = ntohl (lookup_msg->rd_count); |
159 | struct GNUNET_GNSRECORD_Data rd[rd_count]; | 157 | struct GNUNET_GNSRECORD_Data rd[rd_count]; |
160 | 158 | ||
161 | (void) cls; | 159 | (void) cls; |
162 | if (GNUNET_SYSERR == | 160 | if (GNUNET_SYSERR == |
163 | GNUNET_GNSRECORD_records_deserialize (mlen, | 161 | GNUNET_GNSRECORD_records_deserialize (mlen, |
@@ -201,7 +199,7 @@ handle_result (void *cls, | |||
201 | return; | 199 | return; |
202 | proc = lr->lookup_proc; | 200 | proc = lr->lookup_proc; |
203 | proc_cls = lr->proc_cls; | 201 | proc_cls = lr->proc_cls; |
204 | 202 | ||
205 | GNUNET_assert (GNUNET_OK == | 203 | GNUNET_assert (GNUNET_OK == |
206 | GNUNET_GNSRECORD_records_deserialize (mlen, | 204 | GNUNET_GNSRECORD_records_deserialize (mlen, |
207 | (const char*) &lookup_msg[1], | 205 | (const char*) &lookup_msg[1], |
@@ -234,7 +232,6 @@ reconnect (struct GNUNET_GNS_Handle *handle) | |||
234 | handle), | 232 | handle), |
235 | GNUNET_MQ_handler_end () | 233 | GNUNET_MQ_handler_end () |
236 | }; | 234 | }; |
237 | struct GNUNET_GNS_LookupRequest *lh; | ||
238 | 235 | ||
239 | GNUNET_assert (NULL == handle->mq); | 236 | GNUNET_assert (NULL == handle->mq); |
240 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 237 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -246,7 +243,9 @@ reconnect (struct GNUNET_GNS_Handle *handle) | |||
246 | handle); | 243 | handle); |
247 | if (NULL == handle->mq) | 244 | if (NULL == handle->mq) |
248 | return; | 245 | return; |
249 | for (lh = handle->lookup_head; NULL != lh; lh = lh->next) | 246 | for (struct GNUNET_GNS_LookupRequest *lh = handle->lookup_head; |
247 | NULL != lh; | ||
248 | lh = lh->next) | ||
250 | GNUNET_MQ_send_copy (handle->mq, | 249 | GNUNET_MQ_send_copy (handle->mq, |
251 | lh->env); | 250 | lh->env); |
252 | } | 251 | } |
@@ -302,17 +301,21 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle) | |||
302 | * Cancel pending lookup request | 301 | * Cancel pending lookup request |
303 | * | 302 | * |
304 | * @param lr the lookup request to cancel | 303 | * @param lr the lookup request to cancel |
304 | * @return closure from the lookup result processor | ||
305 | */ | 305 | */ |
306 | void | 306 | void * |
307 | GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) | 307 | GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) |
308 | { | 308 | { |
309 | struct GNUNET_GNS_Handle *handle = lr->gns_handle; | 309 | struct GNUNET_GNS_Handle *handle = lr->gns_handle; |
310 | void *ret; | ||
310 | 311 | ||
311 | GNUNET_CONTAINER_DLL_remove (handle->lookup_head, | 312 | GNUNET_CONTAINER_DLL_remove (handle->lookup_head, |
312 | handle->lookup_tail, | 313 | handle->lookup_tail, |
313 | lr); | 314 | lr); |
314 | GNUNET_MQ_discard (lr->env); | 315 | GNUNET_MQ_discard (lr->env); |
316 | ret = lr->proc_cls; | ||
315 | GNUNET_free (lr); | 317 | GNUNET_free (lr); |
318 | return ret; | ||
316 | } | 319 | } |
317 | 320 | ||
318 | 321 | ||