-static int
-inbound_notify (void *cls,
- const struct GNUNET_PeerIdentity *other,
- const struct GNUNET_MessageHeader *message,
- struct GNUNET_TIME_Relative latency,
- uint32_t distance)
-{
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Core provides inbound data from `%4s'.\n", GNUNET_i2s (other));
-#endif
- return GNUNET_OK;
+ if ((throughput_out > (max_quota_out + quota_delta)) ||
+ (throughput_in > (max_quota_in + quota_delta)))
+ ok = 1; /* fail */
+ else
+ ok = 0; /* pass */
+ GNUNET_STATISTICS_get (p1.stats,
+ "core",
+ "# discarded CORE_SEND requests",
+ NULL,
+ &print_stat,
+ &p1);
+ GNUNET_STATISTICS_get (p1.stats,
+ "core",
+ "# discarded CORE_SEND request bytes",
+ NULL,
+ &print_stat,
+ &p1);
+ GNUNET_STATISTICS_get (p1.stats,
+ "core",
+ "# discarded lower priority CORE_SEND requests",
+ NULL,
+ &print_stat,
+ NULL);
+ GNUNET_STATISTICS_get (p1.stats,
+ "core",
+ "# discarded lower priority CORE_SEND request bytes",
+ NULL,
+ &print_stat,
+ &p1);
+ GNUNET_STATISTICS_get (p2.stats,
+ "core",
+ "# discarded CORE_SEND requests",
+ NULL,
+ &print_stat,
+ &p2);
+
+ GNUNET_STATISTICS_get (p2.stats,
+ "core",
+ "# discarded CORE_SEND request bytes",
+ NULL,
+ &print_stat,
+ &p2);
+ GNUNET_STATISTICS_get (p2.stats,
+ "core",
+ "# discarded lower priority CORE_SEND requests",
+ NULL,
+ &print_stat,
+ &p2);
+ GNUNET_STATISTICS_get (p2.stats,
+ "core",
+ "# discarded lower priority CORE_SEND request bytes",
+ NULL,
+ &print_stat,
+ &p2);
+
+ if (ok != 0)
+ kind = GNUNET_ERROR_TYPE_ERROR;
+ switch (test)
+ {
+ case SYMMETRIC:
+ GNUNET_log (kind,
+ "Core quota compliance test with symmetric quotas: %s\n",
+ (0 == ok) ? "PASSED" : "FAILED");
+ break;
+ case ASYMMETRIC_SEND_LIMITED:
+ GNUNET_log (kind,
+ "Core quota compliance test with limited sender quota: %s\n",
+ (0 == ok) ? "PASSED" : "FAILED");
+ break;
+ case ASYMMETRIC_RECV_LIMITED:
+ GNUNET_log (kind,
+ "Core quota compliance test with limited receiver quota: %s\n",
+ (0 == ok) ? "PASSED" : "FAILED");
+ break;
+ };
+ GNUNET_log (kind,
+ "Peer 1 send rate: %llu b/s (%llu bytes in %llu ms)\n",
+ throughput_out,
+ total_bytes_sent,
+ delta);
+ GNUNET_log (kind,
+ "Peer 1 send quota: %llu b/s\n",
+ current_quota_p1_out);
+ GNUNET_log (kind,
+ "Peer 2 receive rate: %llu b/s (%llu bytes in %llu ms)\n",
+ throughput_in,
+ total_bytes_recv,
+ delta);
+ GNUNET_log (kind,
+ "Peer 2 receive quota: %llu b/s\n",
+ current_quota_p2_in);
+/*
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. inbound quota allowed: %llu b/s\n",max_quota_in );
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. outbound quota allowed: %llu b/s\n",max_quota_out);
+*/
+ GNUNET_SCHEDULER_shutdown ();