Merge "libsysutils: SocketListener: handle recv errors more gracefully."
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 @@
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) {