diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-02-14 16:26:07 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-02-14 16:26:07 +0000 |
commit | 19f2a2b61f393852e0aa02d7285e830b607a9b9c (patch) | |
tree | 8af63a52f028f62b543b15ccf8ba3fd0baefe8b0 | |
parent | a80475564fdced61fa9853468e441a352b11ae08 (diff) | |
parent | 04ba32f1a4754bf857926ce3a9e4f9e4159b3187 (diff) | |
download | netd-pie-qpr2-release.tar.gz |
Merge cherrypicks of [6391991, 6392011, 6391992, 6391993, 6392031, 6392051, 6392052, 6392091, 6392111, 6392032, 6391994, 6391995, 6391996, 6391997, 6391998, 6391999, 6392000, 6392001, 6392002, 6392003, 6392004, 6392005, 6392006, 6392112, 6392113, 6392151, 6392152] into pi-qpr2-releaseandroid-9.0.0_r35pie-qpr2-release
Change-Id: I74df5022d170c8188ab4932fac4bf99f57f175f7
-rw-r--r-- | server/MDnsSdListener.cpp | 11 | ||||
-rw-r--r-- | server/MDnsSdListener.h | 3 | ||||
-rw-r--r-- | server/NetworkController.cpp | 4 |
3 files changed, 15 insertions, 3 deletions
diff --git a/server/MDnsSdListener.cpp b/server/MDnsSdListener.cpp index e497bfde..b54014cd 100644 --- a/server/MDnsSdListener.cpp +++ b/server/MDnsSdListener.cpp @@ -146,7 +146,7 @@ void MDnsSdListener::Handler::stop(SocketClient *cli, int argc, char **argv, con return; } if (VDBG) ALOGD("Stopping %s with ref %p", str, ref); - DNSServiceRefDeallocate(*ref); + mMonitor->deallocateServiceRef(ref); mMonitor->freeServiceRef(requestId); char *msg; asprintf(&msg, "%s stopped", str); @@ -610,7 +610,9 @@ void MDnsSdListener::Monitor::run() { ALOGD("Monitor found [%d].revents = %d - calling ProcessResults", i, mPollFds[i].revents); } + pthread_mutex_lock(&mHeadMutex); DNSServiceProcessResult(*(mPollRefs[i])); + pthread_mutex_unlock(&mHeadMutex); mPollFds[i].revents = 0; } } @@ -763,3 +765,10 @@ void MDnsSdListener::Monitor::freeServiceRef(int id) { } pthread_mutex_unlock(&mHeadMutex); } + +void MDnsSdListener::Monitor::deallocateServiceRef(DNSServiceRef* ref) { + pthread_mutex_lock(&mHeadMutex); + DNSServiceRefDeallocate(*ref); + *ref = nullptr; + pthread_mutex_unlock(&mHeadMutex); +} diff --git a/server/MDnsSdListener.h b/server/MDnsSdListener.h index 8cd596a0..8c6096e8 100644 --- a/server/MDnsSdListener.h +++ b/server/MDnsSdListener.h @@ -79,8 +79,9 @@ private: int startService(); int stopService(); void run(); + void deallocateServiceRef(DNSServiceRef* ref); - private: + private: int rescan(); // returns the number of elements in the poll class Element { public: diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp index 5bbfe3f2..a2600561 100644 --- a/server/NetworkController.cpp +++ b/server/NetworkController.cpp @@ -629,7 +629,9 @@ bool NetworkController::removeInterfaceAddress(unsigned ifindex, const char* add std::unordered_set<unsigned>& ifindices = ifindicesIter->second; if (ifindices.erase(ifindex) > 0) { if (ifindices.size() == 0) { - mAddressToIfindices.erase(ifindicesIter); + mAddressToIfindices.erase(ifindicesIter); // Invalidates ifindices + // The address is no longer configured on any interface. + return true; } } else { ALOGE("No record of address %s on interface %u", address, ifindex); |