- /* Keep around the last value so that we don't stupidly pick 0 when
- * we're negative. If we pick 0, it looks to the limiter like it
- * has free reign and it will take 100% of the rate allocation for
- * itself. */
- if (value <= 0) {
- //*aggregate = comm->gossip.last_nonzero;
- *aggregate = 0;
- //printf("*****Gossip value is %.3f (%u) ((%d))\n", value, *aggregate, (int) *aggregate);
- } else {
- *aggregate = value;
- comm->gossip.last_nonzero = *aggregate;
- //printf("Gossip value is %.3f (%u) ((%d))\n", value, *aggregate, (int) *aggregate);
+ /* Look up the failure handling policy and check to see if it is
+ * is currently relevant. */
+ if (comm->gossip.failure_behavior == PANIC) {
+ int panic = 0;
+ if (!comm->connected) {
+ panic = 1;
+ }
+
+ for (i = 0; i < comm->remote_node_count; ++i) {
+ if (comm->remote_limiters[i].reachability != REACHABLE) {
+ panic = 1;
+ }
+ }
+
+ if (panic) {
+ printlog(LOG_DEBUG, "GOSSIP: Panicking!\n");
+ *aggregate = comm->local_rate;
+ *effective_global = (global_limit / (comm->remote_node_count + 1));
+ } else {
+ *aggregate = (value > 0) ? value : 0;
+ *effective_global = global_limit;
+ }
+ } else if (comm->gossip.failure_behavior == QUORUM) {
+ *effective_global = global_limit;
+ if (comm->connected) {
+ for (i = 0; i < comm->remote_node_count; ++i) {
+ if (comm->remote_limiters[i].reachability != REACHABLE) {
+ *effective_global -= (global_limit / (comm->remote_node_count + 1));
+ }
+ }
+ *aggregate = (value > 0) ? value : 0;
+ } else {
+ /* Not part of the Quorum - do 1/n. */
+ printlog(LOG_DEBUG, "GOSSIP: Not in the quorum...Panicking!\n");
+ *aggregate = comm->local_rate;
+ *effective_global = (global_limit / (comm->remote_node_count + 1));
+ }