diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-09 15:30:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-09 15:30:22 +0000 |
commit | 5c7c6e303b1a46de5d8bab8eba7ec1e334c0b0eb (patch) | |
tree | a2a579bc87b79aadac7d88291a0591f4ced02aa8 /src/ats | |
parent | ef9e50ff435266d37de3b5c54fbebbfa3a68db7c (diff) | |
download | gnunet-5c7c6e303b1a46de5d8bab8eba7ec1e334c0b0eb.tar.gz gnunet-5c7c6e303b1a46de5d8bab8eba7ec1e334c0b0eb.zip |
do proper check for stability, in particular UINT32_MAX-0 is not a delta of 1...
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/gnunet-service-ats_plugins.c | 30 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_scheduling.c | 3 |
2 files changed, 19 insertions, 14 deletions
diff --git a/src/ats/gnunet-service-ats_plugins.c b/src/ats/gnunet-service-ats_plugins.c index 10a28f3e4..fbc047a33 100644 --- a/src/ats/gnunet-service-ats_plugins.c +++ b/src/ats/gnunet-service-ats_plugins.c | |||
@@ -190,6 +190,7 @@ solver_info_cb (void *cls, | |||
190 | (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL"); | 190 | (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL"); |
191 | return; | 191 | return; |
192 | default: | 192 | default: |
193 | GNUNET_break (0); | ||
193 | break; | 194 | break; |
194 | } | 195 | } |
195 | } | 196 | } |
@@ -205,12 +206,14 @@ static void | |||
205 | bandwidth_changed_cb (void *cls, | 206 | bandwidth_changed_cb (void *cls, |
206 | struct ATS_Address *address) | 207 | struct ATS_Address *address) |
207 | { | 208 | { |
208 | uint32_t diff_out; | 209 | long long diff_out; |
209 | uint32_t diff_in; | 210 | long long diff_in; |
210 | 211 | ||
211 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
212 | "Bandwidth assignment changed for peer %s \n", | 213 | "Bandwidth assignment changed for peer %s to %u/%u\n", |
213 | GNUNET_i2s (&address->peer)); | 214 | GNUNET_i2s (&address->peer), |
215 | (unsigned int) address->assigned_bw_in, | ||
216 | (unsigned int) address->assigned_bw_out); | ||
214 | 217 | ||
215 | /* Notify performance clients about changes to address */ | 218 | /* Notify performance clients about changes to address */ |
216 | GAS_performance_notify_all_clients (&address->peer, | 219 | GAS_performance_notify_all_clients (&address->peer, |
@@ -226,7 +229,7 @@ bandwidth_changed_cb (void *cls, | |||
226 | if ( (0 == address->assigned_bw_in) && | 229 | if ( (0 == address->assigned_bw_in) && |
227 | (0 == address->assigned_bw_out) ) | 230 | (0 == address->assigned_bw_out) ) |
228 | { | 231 | { |
229 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 232 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
230 | "Telling transport to disconnect peer `%s'\n", | 233 | "Telling transport to disconnect peer `%s'\n", |
231 | GNUNET_i2s (&address->peer)); | 234 | GNUNET_i2s (&address->peer)); |
232 | 235 | ||
@@ -239,14 +242,19 @@ bandwidth_changed_cb (void *cls, | |||
239 | } | 242 | } |
240 | 243 | ||
241 | /* Do bandwidth stability check */ | 244 | /* Do bandwidth stability check */ |
242 | diff_out = abs (address->assigned_bw_out - address->last_notified_bw_out); | 245 | diff_out = llabs ((long long) address->assigned_bw_out - |
243 | diff_in = abs (address->assigned_bw_in - address->last_notified_bw_in); | 246 | (long long) address->last_notified_bw_out); |
244 | 247 | diff_in = llabs ((long long) address->assigned_bw_in - | |
245 | if ( (diff_out < htonl(GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__)) && | 248 | (long long) address->last_notified_bw_in); |
246 | (diff_in < htonl(GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__)) ) | 249 | if ( (diff_out < htonl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__)) && |
250 | (diff_in < htonl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__)) ) | ||
251 | { | ||
252 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
253 | "Bandwidth change too small, not notifying client\n"); | ||
247 | return; | 254 | return; |
255 | } | ||
248 | 256 | ||
249 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 257 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
250 | "Sending bandwidth update for peer `%s': %u/%u\n", | 258 | "Sending bandwidth update for peer `%s': %u/%u\n", |
251 | GNUNET_i2s (&address->peer), | 259 | GNUNET_i2s (&address->peer), |
252 | address->assigned_bw_out, | 260 | address->assigned_bw_out, |
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c index aba9858a1..74b83bf45 100644 --- a/src/ats/gnunet-service-ats_scheduling.c +++ b/src/ats/gnunet-service-ats_scheduling.c | |||
@@ -206,9 +206,6 @@ GAS_handle_address_update (void *cls, | |||
206 | uint32_t ats_count; | 206 | uint32_t ats_count; |
207 | uint16_t size; | 207 | uint16_t size; |
208 | 208 | ||
209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
210 | "Received `%s' message\n", | ||
211 | "ADDRESS_UPDATE"); | ||
212 | size = ntohs (message->size); | 209 | size = ntohs (message->size); |
213 | if (size < sizeof (struct AddressUpdateMessage)) | 210 | if (size < sizeof (struct AddressUpdateMessage)) |
214 | { | 211 | { |