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:
@@ -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:
|
||||
|
||||
@@ -34,6 +34,7 @@ private:
|
||||
BMessenger fTarget;
|
||||
BString fDevice;
|
||||
AutoconfigClient* fCurrentClient;
|
||||
int32 fLastMediaStatus;
|
||||
};
|
||||
|
||||
#endif // AUTOCONFIG_LOOPER_H
|
||||
|
||||
Reference in New Issue
Block a user