Only unschedule when we know it may already be scheduled

This commit is contained in:
Jeremy Lakeman 2012-10-17 16:28:47 +10:30
parent 3ab474be16
commit 01bcd07d6f

View File

@ -102,7 +102,6 @@ static void directory_update(struct sched_ent *alarm){
if (subscriber_is_reachable(directory_service) != REACHABLE_NONE){ if (subscriber_is_reachable(directory_service) != REACHABLE_NONE){
directory_send_keyring(directory_service); directory_send_keyring(directory_service);
unschedule(alarm);
alarm->alarm = gettime_ms() + DIRECTORY_UPDATE_INTERVAL; alarm->alarm = gettime_ms() + DIRECTORY_UPDATE_INTERVAL;
alarm->deadline = alarm->alarm + 10000; alarm->deadline = alarm->alarm + 10000;
schedule(alarm); schedule(alarm);
@ -112,6 +111,7 @@ static void directory_update(struct sched_ent *alarm){
} }
int directory_service_init(){ int directory_service_init(){
unschedule(&directory_alarm);
directory_update(&directory_alarm); directory_update(&directory_alarm);
return 0; return 0;
} }