From 23a95ded83313c8df50c5c34e0c12469e056545c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 4 Jan 2018 22:37:20 +0100 Subject: [PATCH] do not put NULL block --- src/regex/regex_internal_dht.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c index b80dabca0..828bb1648 100644 --- a/src/regex/regex_internal_dht.c +++ b/src/regex/regex_internal_dht.c @@ -154,23 +154,30 @@ regex_iterator (void *cls, NULL, NULL); } block = REGEX_BLOCK_create (proof, - num_edges, edges, + num_edges, + edges, accepting, &size); - (void) - GNUNET_DHT_put (h->dht, key, - DHT_REPLICATION, - DHT_OPT, - GNUNET_BLOCK_TYPE_REGEX, - size, block, - GNUNET_TIME_relative_to_absolute (DHT_TTL), - NULL, NULL); + if (NULL == block) + return; + (void) GNUNET_DHT_put (h->dht, + key, + DHT_REPLICATION, + DHT_OPT, + GNUNET_BLOCK_TYPE_REGEX, + size, + block, + GNUNET_TIME_relative_to_absolute (DHT_TTL), + NULL, + NULL); GNUNET_STATISTICS_update (h->stats, "# regex blocks stored", - 1, GNUNET_NO); + 1, + GNUNET_NO); GNUNET_STATISTICS_update (h->stats, "# regex block bytes stored", - size, GNUNET_NO); + size, + GNUNET_NO); GNUNET_free (block); } -- 2.25.1