Don't schedule another poll if the interface is down

This commit is contained in:
Jeremy Lakeman 2013-08-28 17:04:26 +09:30
parent 7a4b1c3f19
commit 95831a51aa

View File

@ -757,8 +757,10 @@ static void overlay_interface_poll(struct sched_ent *alarm)
if (interface->state==INTERFACE_STATE_UP if (interface->state==INTERFACE_STATE_UP
&& interface->destination->tick_ms>0 && interface->destination->tick_ms>0
&& interface->send_broadcasts){ && interface->send_broadcasts){
if (now >= interface->destination->last_tx+interface->destination->tick_ms) if (now >= interface->destination->last_tx+interface->destination->tick_ms)
overlay_send_tick_packet(interface->destination); overlay_send_tick_packet(interface->destination);
alarm->alarm=interface->destination->last_tx+interface->destination->tick_ms; alarm->alarm=interface->destination->last_tx+interface->destination->tick_ms;
alarm->deadline=alarm->alarm+interface->destination->tick_ms/2; alarm->deadline=alarm->alarm+interface->destination->tick_ms/2;
} }
@ -773,7 +775,7 @@ static void overlay_interface_poll(struct sched_ent *alarm)
break; break;
} }
if (alarm->alarm!=-1) { if (alarm->alarm!=-1 && interface->state==INTERFACE_STATE_UP) {
if (alarm->alarm < now) if (alarm->alarm < now)
alarm->alarm = now; alarm->alarm = now;
schedule(alarm); schedule(alarm);