diff options
| author | San Mehat <san@google.com> | 2009-05-12 19:06:54 -0700 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-05-12 19:06:54 -0700 |
| commit | 8cdd90163ec7103e3cec95c0f402cfc068b8de03 (patch) | |
| tree | 510ec0c1f61a30c376910f486539aed1f349add3 | |
| parent | 62b68731eb859d1498144f6f834ff54b164a9be0 (diff) | |
| parent | dbdb0db516fa4935ff7b5c05914932099237d808 (diff) | |
| download | system_core-8cdd90163ec7103e3cec95c0f402cfc068b8de03.zip system_core-8cdd90163ec7103e3cec95c0f402cfc068b8de03.tar.gz system_core-8cdd90163ec7103e3cec95c0f402cfc068b8de03.tar.bz2 | |
am dbdb0db: libsysutils: Fix bug where we\'d leak our control pipes when
Merge commit 'dbdb0db516fa4935ff7b5c05914932099237d808'
* commit 'dbdb0db516fa4935ff7b5c05914932099237d808':
libsysutils: Fix bug where we'd leak our control pipes when closing down a listener
| -rw-r--r-- | libsysutils/src/SocketListener.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libsysutils/src/SocketListener.cpp b/libsysutils/src/SocketListener.cpp index 57f31f1..7e38546 100644 --- a/libsysutils/src/SocketListener.cpp +++ b/libsysutils/src/SocketListener.cpp @@ -83,13 +83,13 @@ int SocketListener::stopListener() { return -1; } - LOGD("Signaled listener thread - waiting for it to die"); void *ret; if (pthread_join(mThread, &ret)) { LOGE("Error joining to listener thread (%s)", strerror(errno)); return -1; } - LOGD("Listener stopped"); + close(mCtrlPipe[0]); + close(mCtrlPipe[1]); return 0; } @@ -97,7 +97,6 @@ void *SocketListener::threadStart(void *obj) { SocketListener *me = reinterpret_cast<SocketListener *>(obj); me->runListener(); - LOGD("Listener thread shutting down"); pthread_exit(NULL); return NULL; } @@ -143,10 +142,8 @@ void SocketListener::runListener() { continue; } - if (FD_ISSET(mCtrlPipe[0], &read_fds)) { - LOGD("Control message received"); + if (FD_ISSET(mCtrlPipe[0], &read_fds)) break; - } if (mListen && FD_ISSET(mSock, &read_fds)) { struct sockaddr addr; socklen_t alen = sizeof(addr); @@ -157,7 +154,6 @@ void SocketListener::runListener() { sleep(1); continue; } - LOGD("SocketListener client connection accepted"); pthread_mutex_lock(&mClientsLock); mClients->push_back(new SocketClient(c)); pthread_mutex_unlock(&mClientsLock); |
