Stop polling interfaces if no phsical interfaces are enabled

This commit is contained in:
Jeremy Lakeman 2014-06-02 14:09:22 +09:30
parent d811978220
commit f93fba11af
2 changed files with 11 additions and 8 deletions

View File

@ -1031,7 +1031,7 @@ void overlay_interface_discover(struct sched_ent *alarm)
if (overlay_interfaces[i].state==INTERFACE_STATE_UP)
overlay_interfaces[i].state=INTERFACE_STATE_DETECTING;
/* Register new dummy interfaces */
/* Register new file interfaces */
int detect_real_interfaces = 0;
const struct config_network_interface *ifconfig = NULL;
for (i = 0; i < config.interfaces.ac; ++i, ifconfig = NULL) {
@ -1123,14 +1123,17 @@ void overlay_interface_discover(struct sched_ent *alarm)
}
// Close any interfaces that have gone away.
for(i = 0; i < OVERLAY_MAX_INTERFACES; i++)
if (overlay_interfaces[i].state==INTERFACE_STATE_DETECTING) {
for(i = 0; i < OVERLAY_MAX_INTERFACES; i++){
if (overlay_interfaces[i].state==INTERFACE_STATE_DETECTING)
overlay_interface_close(&overlay_interfaces[i]);
}
}
alarm->alarm = gettime_ms()+5000;
alarm->deadline = alarm->alarm + 10000;
schedule(alarm);
// if there are no real interfaces to detect, we can wait for the config file to change
if (detect_real_interfaces){
alarm->alarm = gettime_ms()+5000;
alarm->deadline = alarm->alarm + 10000;
schedule(alarm);
}
return;
}

View File

@ -285,7 +285,7 @@ void cf_on_config_change()
dna_helper_start();
directory_service_init();
/* Periodically check for new interfaces */
// check for interfaces at least once after config change
RESCHEDULE_ALARM(overlay_interface_discover, now, 100);
if (link_has_neighbours())