gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit b5454a701bde16ebc577fbb87d09f5dc1ead587e
parent e0c01618605c1ef2901b2002aed6801858603305
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
Date:   Sun, 29 May 2016 11:19:50 +0000

- Fix #4532


Diffstat:
Msrc/fs/gnunet-service-fs_cp.c | 12++++++++----
Msrc/include/gnunet_peerstore_service.h | 3+--
Msrc/peerstore/gnunet-service-peerstore.c | 5++---
Msrc/peerstore/peerstore_api.c | 8++------
4 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c @@ -605,9 +605,8 @@ ats_reserve_callback (void *cls, * @param cls handle to connected peer entry * @param record peerstore record information * @param emsg error message, or NULL if no errors - * @return #GNUNET_NO to stop iterating since we only expect 0 or 1 records */ -static int +static void peer_respect_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg) @@ -615,13 +614,18 @@ peer_respect_cb (void *cls, struct GSF_ConnectedPeer *cp = cls; GNUNET_assert (NULL != cp->respect_iterate_req); - cp->respect_iterate_req = NULL; + printf("Got a record!\n"); if ((NULL != record) && (sizeof (cp->disk_respect) == record->value_size)) cp->disk_respect = cp->ppd.respect = *((uint32_t *)record->value); GSF_push_start_ (cp); if (NULL != cp->creation_cb) cp->creation_cb (cp->creation_cb_cls, cp); - return GNUNET_NO; + if (NULL != record) + { + printf("Cancelling!\n"); + GNUNET_PEERSTORE_iterate_cancel (cp->respect_iterate_req); + cp->respect_iterate_req = NULL; + } } diff --git a/src/include/gnunet_peerstore_service.h b/src/include/gnunet_peerstore_service.h @@ -133,9 +133,8 @@ typedef void * @param cls closure * @param record peerstore record information * @param emsg error message, or NULL if no errors - * @return #GNUNET_YES to continue iterating, #GNUNET_NO to stop */ -typedef int +typedef void (*GNUNET_PEERSTORE_Processor) (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg); diff --git a/src/peerstore/gnunet-service-peerstore.c b/src/peerstore/gnunet-service-peerstore.c @@ -251,7 +251,7 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) * @param emsg error message or NULL if no errors * @return #GNUNET_YES to continue iteration */ -static int +static void record_iterator (void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg) { @@ -270,7 +270,7 @@ record_iterator (void *cls, const struct GNUNET_PEERSTORE_Record *record, GNUNET_SERVER_receive_done (cls_record->client, NULL == emsg ? GNUNET_OK : GNUNET_SYSERR); PEERSTORE_destroy_record (cls_record); - return GNUNET_NO; + return; } srm = @@ -282,7 +282,6 @@ record_iterator (void *cls, const struct GNUNET_PEERSTORE_Record *record, (struct GNUNET_MessageHeader *) srm, GNUNET_NO); GNUNET_free (srm); - return GNUNET_YES; } diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c @@ -670,7 +670,6 @@ handle_iterate_result (void *cls, const struct GNUNET_MessageHeader *msg) void *callback_cls; uint16_t msg_type; struct GNUNET_PEERSTORE_Record *record; - int continue_iter; ic = h->iterate_head; if (NULL == ic) @@ -704,16 +703,13 @@ handle_iterate_result (void *cls, const struct GNUNET_MessageHeader *msg) { record = PEERSTORE_parse_record_message (msg); if (NULL == record) - continue_iter = - callback (callback_cls, NULL, + callback (callback_cls, NULL, _("Received a malformed response from service.")); else { - continue_iter = callback (callback_cls, record, NULL); + callback (callback_cls, record, NULL); PEERSTORE_destroy_record (record); } - if (GNUNET_NO == continue_iter) - ic->callback = NULL; } }