From adbb529b74ba2cc63880c11522c09b50fef34823 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20B=C3=BCnger?= Date: Mon, 25 Feb 2019 20:36:44 +0100 Subject: [PATCH] RPS sampler: An id might be removed while a request is still pending --- src/rps/gnunet-service-rps.c | 7 ++++++- src/rps/gnunet-service-rps_sampler.h | 6 ++++++ src/rps/rps-sampler_common.c | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index a185645ef..098c71f93 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -2389,6 +2389,12 @@ hist_update (const struct GNUNET_PeerIdentity *ids, for (i = 0; i < num_peers; i++) { int inserted; + if (GNUNET_YES != check_peer_known (sub->peer_map, &ids[i])) + { + LOG (GNUNET_ERROR_TYPE_WARNING, + "Peer in history update not known!\n"); + continue; + } inserted = insert_in_view (sub, &ids[i]); if (GNUNET_OK == inserted) { @@ -4369,7 +4375,6 @@ do_round (void *cls) } } // TODO independent of that also get some peers from CADET_get_peers()? - // TODO log/stat expected pushes/difference to received pushes if (CustomPeerMap_size (sub->push_map) < HISTOGRAM_FILE_SLOTS) { sub->push_recv[CustomPeerMap_size (sub->push_map)]++; diff --git a/src/rps/gnunet-service-rps_sampler.h b/src/rps/gnunet-service-rps_sampler.h index 9f60aa7c9..921570f7d 100644 --- a/src/rps/gnunet-service-rps_sampler.h +++ b/src/rps/gnunet-service-rps_sampler.h @@ -90,6 +90,12 @@ RPS_sampler_update (struct RPS_Sampler *sampler, * * Used to get rid of a PeerID. * + * FIXME: This should also consider currently pending requests + * (Pending requests already collect peerids. As long as not all + * requested IDs have been collected, they are kept. + * Ideally, the @p id should be removed from all pending requests. This + * seems quite complicated.) + * * @param sampler the sampler to reinitialise a sampler in. * @param id the id of the samplers to update. */ diff --git a/src/rps/rps-sampler_common.c b/src/rps/rps-sampler_common.c index e34cdd67b..2b0569c61 100644 --- a/src/rps/rps-sampler_common.c +++ b/src/rps/rps-sampler_common.c @@ -215,6 +215,12 @@ RPS_sampler_update (struct RPS_Sampler *sampler, * * Used to get rid of a PeerID. * + * FIXME: This should also consider currently pending requests + * (Pending requests already collect peerids. As long as not all + * requested IDs have been collected, they are kept. + * Ideally, the @p id should be removed from all pending requests. This + * seems quite complicated.) + * * @param sampler the sampler to reinitialise a sampler element in. * @param id the id of the sampler elements to update. */ -- 2.25.1