Don't enable the device if the reachable count is zero.

A logic bug was introduced in bd451cfe15
in which running graph() several times with zero reachable nodes had
the effect of calling device_enable() (instead of keeping the device
disabled).

This results in weird behavior when DeviceStandby is enabled, especially
on Windows where calling device_enable() several times in a row corrupts
I/O structures for the device, rendering it unusable.
This commit is contained in:
Etienne Dechamps 2014-09-06 10:43:15 +01:00
parent 9ad656b512
commit 7ac5263765

View file

@ -292,7 +292,7 @@ static void check_reachability(void) {
if (device_standby) {
if (reachable_count == 0 && became_unreachable_count > 0)
device_disable();
else if (reachable_count == became_reachable_count)
else if (reachable_count > 0 && reachable_count == became_reachable_count)
device_enable();
}
}