mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1590528 - Call CheckAdaptersAddresses at startup r=kershaw
The problem is that the suffix is not always computed when Firefox starts up. This patch adds a pref `network.notify.initial_call` that controls whether CheckAdaptersAddresses gets called imediately after. This call is necessary in order to compute the suffix list, VPN status, etc. This patch also ensures that OnDnsSuffixListUpdated gets called by NetlinkService::ComputeDNSSuffixList on Android. This notification is necessary for the TRRService to pick up the suffix list. Differential Revision: https://phabricator.services.mozilla.com/D55303 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
7ae939ccbc
commit
0848f9ba9a
@ -6940,6 +6940,14 @@
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Whether NotifyIpInterfaceChange should be called immediately after
|
||||
# registration in order to record the initial state of the network adapters.
|
||||
- name: network.notify.initial_call
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "nglayout."
|
||||
#---------------------------------------------------------------------------
|
||||
|
@ -1684,8 +1684,8 @@ bool NetlinkService::CalculateIDForFamily(uint8_t aFamily, SHA1Sum* aSHA1) {
|
||||
|
||||
void NetlinkService::ComputeDNSSuffixList() {
|
||||
MOZ_ASSERT(!NS_IsMainThread(), "Must not be called on the main thread");
|
||||
#if defined(HAVE_RES_NINIT)
|
||||
nsTArray<nsCString> suffixList;
|
||||
#if defined(HAVE_RES_NINIT)
|
||||
struct __res_state res;
|
||||
if (res_ninit(&res) == 0) {
|
||||
for (int i = 0; i < MAXDNSRCH; i++) {
|
||||
@ -1696,18 +1696,16 @@ void NetlinkService::ComputeDNSSuffixList() {
|
||||
}
|
||||
res_nclose(&res);
|
||||
}
|
||||
|
||||
#endif
|
||||
RefPtr<NetlinkServiceListener> listener;
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
listener = mListener;
|
||||
mDNSSuffixList = std::move(suffixList);
|
||||
}
|
||||
|
||||
if (listener) {
|
||||
listener->OnDnsSuffixListUpdated();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void NetlinkService::UpdateLinkStatus() {
|
||||
|
@ -294,8 +294,8 @@ nsNotifyAddrListener::Run() {
|
||||
StaticPrefs::network_notify_IPv6() ? AF_UNSPEC
|
||||
: AF_INET, // IPv4 and IPv6
|
||||
(PIPINTERFACE_CHANGE_CALLBACK)OnInterfaceChange,
|
||||
this, // pass to callback
|
||||
false, // no initial notification
|
||||
this, // pass to callback
|
||||
StaticPrefs::network_notify_initial_call(), // initial notification
|
||||
&interfacechange);
|
||||
|
||||
if (ret == NO_ERROR) {
|
||||
@ -416,6 +416,7 @@ nsresult nsNotifyAddrListener::NotifyObservers(const char* aTopic,
|
||||
|
||||
DWORD
|
||||
nsNotifyAddrListener::CheckAdaptersAddresses(void) {
|
||||
MOZ_ASSERT(!NS_IsMainThread(), "Don't call this on the main thread");
|
||||
ULONG len = 16384;
|
||||
|
||||
PIP_ADAPTER_ADDRESSES adapterList = (PIP_ADAPTER_ADDRESSES)moz_xmalloc(len);
|
||||
|
Loading…
Reference in New Issue
Block a user