From 135ec26aa7c37786e2dfa1d6dc99f9ea407cdb30 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 17 Jun 2011 20:28:00 +0000 Subject: [PATCH] checks --- src/fs/gnunet-service-fs_cp.c | 4 +++- src/fs/gnunet-service-fs_pr.c | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 350ee54f1..56129273c 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -1189,6 +1189,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, enum GNUNET_BLOCK_Type type; GNUNET_PEER_Id spid; + GNUNET_assert (other != NULL); msize = ntohs(message->size); if (msize < sizeof (struct GetMessage)) { @@ -1299,13 +1300,14 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, spid = 0; if ( (GNUNET_LOAD_get_load (cp->ppd.transmission_delay) > 3 * (1 + priority)) || (GNUNET_LOAD_get_average (cp->ppd.transmission_delay) > - GNUNET_CONSTANTS_MAX_CORK_DELAY.rel_value * 2 + GNUNET_LOAD_get_average (GSF_rt_entry_lifetime)) ) + GNUNET_CONSTANTS_MAX_CORK_DELAY.rel_value * 2 + GNUNET_LOAD_get_average (GSF_rt_entry_lifetime)) ) { /* don't have BW to send to peer, or would likely take longer than we have for it, so at best indirect the query */ priority = 0; options |= GSF_PRO_FORWARD_ONLY; spid = GNUNET_PEER_intern (other); + GNUNET_assert (0 != spid); } ttl = bound_ttl (ntohl (gm->ttl), priority); /* decrement ttl (always) */ diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index e17d778db..c43b1be04 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -328,6 +328,8 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, pr->sender_pid = sender_pid; pr->rh = rh; pr->rh_cls = rh_cls; + GNUNET_assert ( (sender_pid != 0) || + (0 == (options & GSF_PRO_FORWARD_ONLY)) ); if (ttl >= 0) pr->public_data.ttl = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, (uint32_t) ttl)); @@ -503,10 +505,10 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr, k = 0; bm = 0; do_route = (0 == (pr->public_data.options & GSF_PRO_FORWARD_ONLY)); - if ( (do_route) && (pr->sender_pid == 0)) + if ( (! do_route) && (pr->sender_pid == 0)) { GNUNET_break (0); - do_route = GNUNET_NO; + do_route = GNUNET_YES; } if (! do_route) { -- 2.25.1