}
}
-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;
+ printlog(LOG_WARN, "AWOL remote limiter detected.\n");
+ remote->rate += ((decayto - remote->rate) / 2);
} else {
remote->awol++;
}
sigemptyset(&signal_mask);
sigaddset(&signal_mask, SIGHUP);
+ sigaddset(&signal_mask, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &signal_mask, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);