}
}
-int read_comm(comm_t *comm, double *aggregate) {
+int read_comm(comm_t *comm, double *aggregate, double decayto) {
remote_limiter_t *remote;
pthread_mutex_lock(&comm->lock);
*aggregate += remote->rate;
/* If we continue to read it without having heard an update,
- * we start to decay its value. */
+ * we start to make the peer's value approach decayto, getting
+ * half of the way there each time. */
if (remote->awol >= REMOTE_AWOL_THRESHOLD) {
- remote->rate = remote->rate / 2;
+ remote->rate += ((decayto - remote->rate) / 2);
} else {
remote->awol++;
}