diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2024-02-25 17:37:35 +0100 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2024-02-25 17:37:35 +0100 |
commit | 2bf23f075a55fb534c008f80e1ce020c613f7d74 (patch) | |
tree | 9a116b687b7282263ad84be0fe7f7f3340349f6c | |
parent | b6377a22a050b818eaa184b98e938ca41465c5eb (diff) | |
download | gnunet-2bf23f075a55fb534c008f80e1ce020c613f7d74.tar.gz gnunet-2bf23f075a55fb534c008f80e1ce020c613f7d74.zip |
PEERSTORE: Fix iteration bugs in iteration
-rw-r--r-- | src/service/peerstore/gnunet-service-peerstore.c | 2 | ||||
-rw-r--r-- | src/service/peerstore/peerstore_api.c | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/service/peerstore/gnunet-service-peerstore.c b/src/service/peerstore/gnunet-service-peerstore.c index 72c7b035f..37af3af56 100644 --- a/src/service/peerstore/gnunet-service-peerstore.c +++ b/src/service/peerstore/gnunet-service-peerstore.c | |||
@@ -646,7 +646,7 @@ handle_iterate_stop (void *cls, | |||
646 | 646 | ||
647 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 647 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
648 | "Received ITERATION_STOP message\n"); | 648 | "Received ITERATION_STOP message\n"); |
649 | rid = ntohl (zis_msg->rid); | 649 | rid = ntohs (zis_msg->rid); |
650 | for (ic = pc->op_head; NULL != ic; ic = ic->next) | 650 | for (ic = pc->op_head; NULL != ic; ic = ic->next) |
651 | if (ic->request_id == rid) | 651 | if (ic->request_id == rid) |
652 | break; | 652 | break; |
diff --git a/src/service/peerstore/peerstore_api.c b/src/service/peerstore/peerstore_api.c index a69237c9b..3b945928a 100644 --- a/src/service/peerstore/peerstore_api.c +++ b/src/service/peerstore/peerstore_api.c | |||
@@ -864,7 +864,7 @@ hello_add_iter (void *cls, const struct GNUNET_PEERSTORE_Record *record, | |||
864 | struct GNUNET_PEERSTORE_StoreHelloContext *huc = cls; | 864 | struct GNUNET_PEERSTORE_StoreHelloContext *huc = cls; |
865 | struct GNUNET_TIME_Absolute hello_exp = | 865 | struct GNUNET_TIME_Absolute hello_exp = |
866 | GNUNET_HELLO_builder_get_expiration_time (huc->hello); | 866 | GNUNET_HELLO_builder_get_expiration_time (huc->hello); |
867 | if (NULL == record) | 867 | if ((NULL == record) && (NULL == emsg)) |
868 | { | 868 | { |
869 | /** If we ever get here, we are newer than the existing record | 869 | /** If we ever get here, we are newer than the existing record |
870 | * or the only/first record. | 870 | * or the only/first record. |
@@ -881,6 +881,12 @@ hello_add_iter (void *cls, const struct GNUNET_PEERSTORE_Record *record, | |||
881 | huc); | 881 | huc); |
882 | return; | 882 | return; |
883 | } | 883 | } |
884 | if (NULL != emsg) | ||
885 | { | ||
886 | LOG (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg); | ||
887 | GNUNET_PEERSTORE_iteration_next (huc->ic, 1); | ||
888 | return; | ||
889 | } | ||
884 | if (GNUNET_TIME_absolute_cmp (record->expiry, >, hello_exp)) | 890 | if (GNUNET_TIME_absolute_cmp (record->expiry, >, hello_exp)) |
885 | { | 891 | { |
886 | huc->cont (huc->cont_cls, GNUNET_OK); | 892 | huc->cont (huc->cont_cls, GNUNET_OK); |
@@ -889,6 +895,7 @@ hello_add_iter (void *cls, const struct GNUNET_PEERSTORE_Record *record, | |||
889 | GNUNET_free (huc); | 895 | GNUNET_free (huc); |
890 | return; | 896 | return; |
891 | } | 897 | } |
898 | GNUNET_PEERSTORE_iteration_next (huc->ic, 1); | ||
892 | } | 899 | } |
893 | 900 | ||
894 | 901 | ||