diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-02 11:44:27 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-02 11:44:27 +0000 |
commit | 99706d4043a7b4e58496b1b73cd070890b895374 (patch) | |
tree | c7426fd51ce29437bebcacab5a8e3fea7f1b9865 /src/ats | |
parent | a526120c95e139cd21bdfb2cf4e0e3b070e8cf2c (diff) | |
download | gnunet-99706d4043a7b4e58496b1b73cd070890b895374.tar.gz gnunet-99706d4043a7b4e58496b1b73cd070890b895374.zip |
fix: do not assert if plugin sends you invalid network type
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/gnunet-service-ats-solver_proportional.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ats/gnunet-service-ats-solver_proportional.c b/src/ats/gnunet-service-ats-solver_proportional.c index d6b277406..bd5caa849 100644 --- a/src/ats/gnunet-service-ats-solver_proportional.c +++ b/src/ats/gnunet-service-ats-solver_proportional.c | |||
@@ -667,6 +667,7 @@ get_network (struct GAS_PROPORTIONAL_Handle *s, uint32_t type) | |||
667 | { | 667 | { |
668 | if (s->network_entries[c].type == type) | 668 | if (s->network_entries[c].type == type) |
669 | return &s->network_entries[c]; | 669 | return &s->network_entries[c]; |
670 | |||
670 | } | 671 | } |
671 | return NULL; | 672 | return NULL; |
672 | } | 673 | } |
@@ -1109,7 +1110,16 @@ GAS_proportional_address_update (void *solver, | |||
1109 | 1110 | ||
1110 | /* set new network type */ | 1111 | /* set new network type */ |
1111 | new_net = get_network (solver, addr_net); | 1112 | new_net = get_network (solver, addr_net); |
1112 | GNUNET_assert (NULL != new_net); | 1113 | if (NULL == new_net) |
1114 | { | ||
1115 | /* Address changed to invalid network... */ | ||
1116 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Cannot find network of type `%u' %s\n"), | ||
1117 | addr_net, GNUNET_ATS_print_network_type (addr_net)); | ||
1118 | address->assigned_bw_in = GNUNET_BANDWIDTH_value_init (0); | ||
1119 | address->assigned_bw_out = GNUNET_BANDWIDTH_value_init (0); | ||
1120 | s->bw_changed (s->bw_changed_cls, address); | ||
1121 | return; | ||
1122 | } | ||
1113 | address->solver_information = new_net; | 1123 | address->solver_information = new_net; |
1114 | 1124 | ||
1115 | /* Add to new network and update*/ | 1125 | /* Add to new network and update*/ |