diff options
| author | Vernon Tang <vt@foilhead.net> | 2011-04-27 14:01:27 +1000 |
|---|---|---|
| committer | Vernon Tang <vt@foilhead.net> | 2011-04-27 14:01:27 +1000 |
| commit | 8795007a4aedb0860f6e7b838984ba8104f2febc (patch) | |
| tree | 536b5c05ae62e99b85dda1f3f304b5e1f30da622 | |
| parent | 2f7995ee0ff480b4ee06e8944e7d4569b59a5bad (diff) | |
| download | system_core-8795007a4aedb0860f6e7b838984ba8104f2febc.zip system_core-8795007a4aedb0860f6e7b838984ba8104f2febc.tar.gz system_core-8795007a4aedb0860f6e7b838984ba8104f2febc.tar.bz2 | |
libsysutils: SocketListener: handle recv errors more gracefully.
Don't close the socket when onDataAvailable returns false if the socket
is connectionless.
Change-Id: Ie19497f5928144c463d92aa72ba517e675549ea6
| -rw-r--r-- | libsysutils/src/SocketListener.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libsysutils/src/SocketListener.cpp b/libsysutils/src/SocketListener.cpp index 69ed79e..fcad624 100644 --- a/libsysutils/src/SocketListener.cpp +++ b/libsysutils/src/SocketListener.cpp @@ -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) { |
