aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-08 17:40:57 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-08 17:40:57 +0000
commite1669fabbcb9f21c509e03811fe2d8b5b568b15c (patch)
tree79ba26a54432f0694b635d93de80f880a0fc6510 /src
parent551ac76f62a2cb158d068636a442eeb24cf9d372 (diff)
downloadgnunet-e1669fabbcb9f21c509e03811fe2d8b5b568b15c.tar.gz
gnunet-e1669fabbcb9f21c509e03811fe2d8b5b568b15c.zip
-simplify logic, convert breaks into asserts
Diffstat (limited to 'src')
-rw-r--r--src/ats/plugin_ats_proportional.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c
index 87afb400e..7f0fcd042 100644
--- a/src/ats/plugin_ats_proportional.c
+++ b/src/ats/plugin_ats_proportional.c
@@ -840,7 +840,7 @@ get_best_address (struct GAS_PROPORTIONAL_Handle *s,
840 840
841 841
842/** 842/**
843 * Decrease address count in network 843 * Decrease number of active addresses in network.
844 * 844 *
845 * @param s the solver handle 845 * @param s the solver handle
846 * @param net the network type 846 * @param net the network type
@@ -849,28 +849,18 @@ static void
849address_decrement_active (struct GAS_PROPORTIONAL_Handle *s, 849address_decrement_active (struct GAS_PROPORTIONAL_Handle *s,
850 struct Network *net) 850 struct Network *net)
851{ 851{
852 if (net->active_addresses < 1) 852 GNUNET_assert (net->active_addresses > 0);
853 { 853 net->active_addresses--;
854 GNUNET_break (0); 854 GNUNET_STATISTICS_update (s->env->stats,
855 } 855 net->stat_active,
856 else 856 -1,
857 { 857 GNUNET_NO);
858 net->active_addresses--; 858 GNUNET_assert (s->active_addresses > 0);
859 GNUNET_STATISTICS_update (s->env->stats, 859 s->active_addresses--;
860 net->stat_active, -1, GNUNET_NO); 860 GNUNET_STATISTICS_update (s->env->stats,
861 } 861 "# ATS addresses total",
862 if (s->active_addresses < 1) 862 -1,
863 { 863 GNUNET_NO);
864 GNUNET_break (0);
865 }
866 else
867 {
868 s->active_addresses--;
869 GNUNET_STATISTICS_update (s->env->stats,
870 "# ATS addresses total",
871 -1,
872 GNUNET_NO);
873 }
874} 864}
875 865
876 866