Backed out changeset: fe7134fc65ec

This commit is contained in:
Serge Gautherie 2009-02-27 05:50:12 +01:00
parent b84acde538
commit a738c2ca74
4 changed files with 5 additions and 49 deletions

View File

@ -167,7 +167,6 @@ nsIOService::nsIOService()
, mOfflineForProfileChange(PR_FALSE)
, mSettingOffline(PR_FALSE)
, mSetOfflineValue(PR_FALSE)
, mShutdown(PR_FALSE)
, mManageOfflineStatus(PR_TRUE)
, mChannelEventSinks(NS_CHANNEL_EVENT_SINK_CATEGORY)
, mContentSniffers(NS_CONTENT_SNIFFER_CATEGORY)
@ -618,11 +617,6 @@ nsIOService::GetOffline(PRBool *offline)
NS_IMETHODIMP
nsIOService::SetOffline(PRBool offline)
{
// When someone wants to go online (!offline) after we got XPCOM shutdown
// throw ERROR_NOT_AVAILABLE to prevent return to online state.
if (mShutdown && !offline)
return NS_ERROR_NOT_AVAILABLE;
// SetOffline() may re-enter while it's shutting down services.
// If that happens, save the most recent value and it will be
// processed when the first SetOffline() call is done bringing
@ -840,11 +834,6 @@ nsIOService::Observe(nsISupports *subject,
}
}
else if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
// Remember we passed XPCOM shutdown notification to prevent any
// changes of the offline status from now. We must not allow going
// online after this point.
mShutdown = PR_TRUE;
SetOffline(PR_TRUE);
// Break circular reference.
@ -961,9 +950,6 @@ nsIOService::TrackNetworkLinkStatusForOffline()
"Don't call this unless we're managing the offline status");
if (!mNetworkLinkService)
return NS_ERROR_FAILURE;
if (mShutdown)
return NS_ERROR_NOT_AVAILABLE;
// check to make sure this won't collide with Autodial
if (mSocketTransportService) {

View File

@ -140,8 +140,6 @@ private:
PRPackedBool mSettingOffline;
PRPackedBool mSetOfflineValue;
PRPackedBool mShutdown;
nsCOMPtr<nsPISocketTransportService> mSocketTransportService;
nsCOMPtr<nsPIDNSService> mDNSService;
nsCOMPtr<nsIProtocolProxyService2> mProxyService;

View File

@ -41,6 +41,7 @@
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <winsock2.h>
#include <iprtrmib.h>
#include <time.h>
#include "prmem.h"
@ -151,7 +152,6 @@ nsNotifyAddrListener::Run()
PRBool shuttingDown = PR_FALSE;
overlapped.hEvent = ev;
CheckLinkStatus();
while (!shuttingDown) {
HANDLE h;
DWORD ret = sNotifyAddrChange(&h, &overlapped);
@ -318,11 +318,7 @@ nsNotifyAddrListener::CheckIPAddrTable(void)
for (DWORD i = 0; !linkUp && i < table->dwNumEntries; i++) {
if (GetOperationalStatus(table->table[i].dwIndex) >=
MIB_IF_OPER_STATUS_CONNECTED &&
table->table[i].dwAddr != 0 &&
// Also not 192.168.0.1 - the LAN ICS gateway...
table->table[i].dwAddr != 0x0100A8C0 &&
// ...and nor a loopback
table->table[i].dwAddr != 0x0100007F)
table->table[i].dwAddr != 0)
linkUp = PR_TRUE;
}
mLinkUp = linkUp;
@ -372,14 +368,9 @@ nsNotifyAddrListener::CheckAdaptersInfo(void)
else {
PIP_ADDR_STRING ipAddr;
for (ipAddr = &ptr->IpAddressList; ipAddr && !linkUp;
ipAddr = ipAddr->Next) {
if (PL_strcmp(ipAddr->IpAddress.String,
"0.0.0.0") &&
PL_strcmp(ipAddr->IpAddress.String,
"192.168.0.1")) {
ipAddr = ipAddr->Next)
if (PL_strcmp(ipAddr->IpAddress.String, "0.0.0.0"))
linkUp = PR_TRUE;
}
}
}
}
}
@ -391,20 +382,6 @@ nsNotifyAddrListener::CheckAdaptersInfo(void)
return ret;
}
BOOL
nsNotifyAddrListener::CheckAddressIsGateway(LPSOCKADDR aAddress)
{
if (!aAddress)
return FALSE;
PSOCKADDR_IN in_addr = (PSOCKADDR_IN)aAddress;
return aAddress->sa_family == AF_INET &&
in_addr->sin_addr.S_un.S_un_b.s_b1 == 192 &&
in_addr->sin_addr.S_un.S_un_b.s_b2 == 168 &&
in_addr->sin_addr.S_un.S_un_b.s_b3 == 0 &&
in_addr->sin_addr.S_un.S_un_b.s_b4 == 1;
}
DWORD
nsNotifyAddrListener::CheckAdaptersAddresses(void)
{
@ -428,10 +405,7 @@ nsNotifyAddrListener::CheckAdaptersAddresses(void)
for (ptr = addresses; !linkUp && ptr; ptr = ptr->Next) {
if (ptr->OperStatus == IfOperStatusUp &&
ptr->IfType != IF_TYPE_SOFTWARE_LOOPBACK &&
ptr->FirstUnicastAddress &&
!CheckAddressIsGateway(ptr->FirstUnicastAddress->
Address.lpSockaddr))
ptr->IfType != IF_TYPE_SOFTWARE_LOOPBACK)
linkUp = TRUE;
}
mLinkUp = linkUp;

View File

@ -39,7 +39,6 @@
#define NSNOTIFYADDRLISTENER_H_
#include <windows.h>
#include <winsock2.h>
#include "nsINetworkLinkService.h"
#include "nsIRunnable.h"
#include "nsIObserver.h"
@ -83,7 +82,6 @@ protected:
DWORD CheckIPAddrTable(void);
DWORD CheckAdaptersInfo(void);
DWORD CheckAdaptersAddresses(void);
BOOL CheckAddressIsGateway(LPSOCKADDR aAddress);
void CheckLinkStatus(void);
nsCOMPtr<nsIThread> mThread;