libsysutils: SocketListener: handle recv errors more gracefully.

Don't close the socket when onDataAvailable returns false if the socket
is connectionless.

Change-Id: Ie19497f5928144c463d92aa72ba517e675549ea6
This commit is contained in:
Vernon Tang 2011-04-27 14:01:27 +10:00
parent 2f7995ee0f
commit 8795007a4a
1 changed files with 3 additions and 2 deletions

View File

@ -213,8 +213,9 @@ void SocketListener::runListener() {
it = pendingList->begin();
SocketClient* c = *it;
pendingList->erase(it);
/* Process it, if false is returned, remove and destroy it */
if (!onDataAvailable(c)) {
/* Process it, if false is returned and our sockets are
* connection-based, remove and destroy it */
if (!onDataAvailable(c) && mListen) {
/* Remove the client from our array */
pthread_mutex_lock(&mClientsLock);
for (it = mClients->begin(); it != mClients->end(); ++it) {