diff options
author | wachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96> | 2013-01-14 10:01:43 +0000 |
---|---|---|
committer | wachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96> | 2013-01-14 10:01:43 +0000 |
commit | c371b4fa95870d76c940f7accd7e7a40829841cc (patch) | |
tree | 470f0b194f2e16ddf29ae2a65dcdb48dc1a497d3 | |
parent | 5355744675c82e659cf7c6cb3d811eac2d04da20 (diff) |
fix for quota check
git-svn-id: https://gnunet.org/svn/gnunet@25766 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r-- | src/ats/gnunet-service-ats_addresses_simplistic.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/ats/gnunet-service-ats_addresses_simplistic.c b/src/ats/gnunet-service-ats_addresses_simplistic.c index c5e774f562..7a7c4febf3 100644 --- a/src/ats/gnunet-service-ats_addresses_simplistic.c +++ b/src/ats/gnunet-service-ats_addresses_simplistic.c @@ -502,19 +502,25 @@ update_quota_per_network (struct GAS_SIMPLISTIC_Handle *s, } LOG (GNUNET_ERROR_TYPE_DEBUG, - "Total bandwidth assigned is: (in/out): %llu /%llu\n", + "Total bandwidth assigned is (in/out): %llu /%llu\n", quota_in_used, quota_out_used); - if (quota_out_used > quota_out) - LOG (GNUNET_ERROR_TYPE_WARNING, - "DEBUG! Total inbound bandwidth assigned is larget than allowed %llu /%llu\n", + if (quota_out_used > net->total_quota_out + 1) /* +1 is required due to rounding errors */ + { + GNUNET_break (0); + LOG (GNUNET_ERROR_TYPE_WARNING, + "Total inbound bandwidth assigned is larget than allowed %llu /%llu\n", quota_out_used, - quota_out); /* FIXME: Can happen atm, we have some rounding error */ - if (quota_in_used > quota_in) - LOG (GNUNET_ERROR_TYPE_WARNING, - "DEBUG! Total inbound bandwidth assigned is larget than allowed %llu /%llu\n", + quota_out); + } + if (quota_in_used > net->total_quota_in + 1) /* +1 is required due to rounding errors */ + { + GNUNET_break (0); + LOG (GNUNET_ERROR_TYPE_WARNING, + "Total inbound bandwidth assigned is larget than allowed %llu /%llu\n", quota_in_used, - quota_in); /* FIXME: Can happen atm, we have some rounding error */ + quota_in); + } } static void |