Keep more accurate track of media status changes.

AutoConfigLooper now remembers the last media state it received from the device,
and compares both to see if the active state actually changed. Should help with
quality changes where the link didn't actually drop. May also help on ethernet
if the chipset sends spurious link status change notifications.
This commit is contained in:
Rene Gollent
2012-04-11 18:27:20 -04:00
parent b95fa2488a
commit 9cac658a9f
2 changed files with 5 additions and 2 deletions
+4 -2
View File
@@ -32,7 +32,8 @@ AutoconfigLooper::AutoconfigLooper(BMessenger target, const char* device)
: BLooper(device),
fTarget(target),
fDevice(device),
fCurrentClient(NULL)
fCurrentClient(NULL),
fLastMediaStatus(0)
{
BMessage ready(kMsgReadyToRun);
PostMessage(&ready);
@@ -148,11 +149,12 @@ AutoconfigLooper::MessageReceived(BMessage* message)
|| message->FindInt32("media", &media) != B_OK)
break;
if ((media & IFM_ACTIVE) != 0) {
if ((fLastMediaStatus & IFM_ACTIVE) != (media & IFM_ACTIVE)) {
// Reconfigure the interface when we have a link again
_ConfigureIPv4();
//_ConfigureIPv6(); // TODO: router advertisement and dhcpv6
}
fLastMediaStatus = media;
break;
default:
+1
View File
@@ -34,6 +34,7 @@ private:
BMessenger fTarget;
BString fDevice;
AutoconfigClient* fCurrentClient;
int32 fLastMediaStatus;
};
#endif // AUTOCONFIG_LOOPER_H