X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drl%2Fdrl_state.c;h=fed3326d52091585060aee4bb6d04e4a2024c076;hb=98532885e230a587b3cea807cefa0c4176434f9b;hp=8583d0d4edf3f23339f83cebc599cf7ce9b95896;hpb=0be9704d6b24d09ebd55beedec52758cb88c570b;p=distributedratelimiting.git diff --git a/drl/drl_state.c b/drl/drl_state.c index 8583d0d..fed3326 100644 --- a/drl/drl_state.c +++ b/drl/drl_state.c @@ -118,7 +118,7 @@ void free_comm(comm_t *comm) { } } -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); @@ -131,9 +131,11 @@ int read_comm(comm_t *comm, double *aggregate) { *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++; } @@ -212,6 +214,7 @@ void *limiter_receive_thread(void *unused) { sigemptyset(&signal_mask); sigaddset(&signal_mask, SIGHUP); + sigaddset(&signal_mask, SIGUSR1); pthread_sigmask(SIG_BLOCK, &signal_mask, NULL); pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);