- if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK)
- {
- GNUNET_SCHEDULER_cancel (measurement_counter_task);
- measurement_counter_task = GNUNET_SCHEDULER_NO_TASK;
- }
-
- if (transmit_handle != NULL)
- {
- GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle);
- transmit_handle = NULL;
- }
-
- if (current_quota_p1 < current_quota_p2)
- quota_allowed = current_quota_p1;
- else
- quota_allowed = current_quota_p2;
-
-
- if (MEASUREMENT_SOFT_LIMIT > (quota_allowed/3))
- delta = MEASUREMENT_SOFT_LIMIT;
- else
- delta = (quota_allowed/3);
-
- /* Throughput is far too slow. This is to prevent the test to exit with success when throughput is 0 */
- if ((total_bytes_sent/(duration.rel_value / 1000)) < 100)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "\nQuota compliance failed: \n"\
- "Hard quota limit allowed: %10llu kB/s (%llu B/s)\n"\
- "Soft quota limit allowed: %10llu kB/s (%llu B/s)\n"\
- "Throughput : %10llu kB/s (%llu B/s)\n",
- (quota_allowed / (1024)), quota_allowed,
- ((quota_allowed+delta) / (1024)), quota_allowed+delta,
- (total_bytes_sent/(duration.rel_value / 1000)/1024),
- total_bytes_sent/(duration.rel_value / 1000));
- ok = 1;
- failed_measurement_counter--;
- if (failed_measurement_counter < 0)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "\nQuota measurement failed and no free strike: %i\n",failed_measurement_counter);
- end();
- return;
- }
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "\nQuota measurement failed and %i free strikes\n",failed_measurement_counter);
- }
-
- /* Throughput is bigger than allowed quota + some extra*/
- if ((total_bytes_sent/(duration.rel_value / 1000)) > (quota_allowed + delta))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "\nQuota compliance failed: \n"\
- "Hard quota limit allowed: %10llu kB/s (%llu B/s)\n"\
- "Soft quota limit allowed: %10llu kB/s (%llu B/s)\n"\
- "Throughput : %10llu kB/s (%llu B/s)\n",
- (quota_allowed / (1024)), quota_allowed,
- ((quota_allowed+delta) / (1024)), quota_allowed+delta,
- (total_bytes_sent/(duration.rel_value / 1000)/1024),
- total_bytes_sent/(duration.rel_value / 1000));
- ok = 1;
- failed_measurement_counter--;
- if (failed_measurement_counter < 0)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "\nQuota measurement failed and no free strike: %i\n",failed_measurement_counter);
- end();
- return;
- }
- else
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "\nQuota measurement failed and %i free strikes\n",failed_measurement_counter);
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "\nQuota compliance ok: \n"\
- "Quota allowed: %10llu kB/s\n"\
- "Throughput : %10llu kB/s\n", (quota_allowed / (1024)) , (total_bytes_sent/(duration.rel_value / 1000)/1024));
- if (failed_measurement_counter < 2)
- failed_measurement_counter++;
- ok = 0;
- }
-
- if ((quota_allowed) > (2 *(total_bytes_sent/(duration.rel_value / 1000))))
- {
- if (failed_measurement_counter < 2)
- failed_measurement_counter++;
- if (strike_counter == 2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Maximum transmission rate reached, stopping test\n");
- end();
- return;
- }
- }
- else
- {
- strike_counter = 0;
- }