Bug 1240269 - Do not open UDP socket during shutdown. r=mcmanus

This commit is contained in:
Dragana Damjanovic 2016-01-16 01:19:00 -05:00
Родитель d748989a19
Коммит 874fe57403
2 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -138,7 +138,7 @@ private:
private:
bool mOffline;
bool mOfflineForProfileChange;
mozilla::Atomic<bool, mozilla::Relaxed> mOfflineForProfileChange;
bool mManageLinkStatus;
bool mConnectivity;
// If true, the connectivity state will be mirrored by IOService.offline
@ -150,7 +150,7 @@ private:
bool mSettingOffline;
bool mSetOfflineValue;
bool mShutdown;
mozilla::Atomic<bool, mozilla::Relaxed> mShutdown;
nsCOMPtr<nsPISocketTransportService> mSocketTransportService;
nsCOMPtr<nsPIDNSService> mDNSService;

Просмотреть файл

@ -16,6 +16,7 @@
#include "nsError.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIOService.h"
#include "prnetdb.h"
#include "prio.h"
#include "nsNetAddr.h"
@ -332,6 +333,10 @@ nsUDPSocket::TryAttach()
if (!gSocketTransportService)
return NS_ERROR_FAILURE;
if (gIOService->IsNetTearingDown()) {
return NS_ERROR_FAILURE;
}
//
// find out if it is going to be ok to attach another socket to the STS.
// if not then we have to wait for the STS to tell us that it is ok.
@ -581,6 +586,10 @@ nsUDPSocket::InitWithAddress(const NetAddr *aAddr, nsIPrincipal *aPrincipal,
{
NS_ENSURE_TRUE(mFD == nullptr, NS_ERROR_ALREADY_INITIALIZED);
if (gIOService->IsNetTearingDown()) {
return NS_ERROR_FAILURE;
}
bool addressReuse = (aOptionalArgc == 1) ? aAddressReuse : true;
//