Diligently check poll() a bit more. Also determine number of servers based on cores...
[m6w6/libmemcached] / libmemcached / io.cc
index c848b6318e5bd5f7e14960bd2be16028aaa2b5cb..b08473a0c9bef42206d352c542f34a336c1549ad 100644 (file)
@@ -213,8 +213,18 @@ static memcached_return_t io_wait(memcached_server_write_instance_st ptr,
 
     if (active_fd >= 1)
     {
+      if (fds.revents & POLLHUP)
+      {
+        break;
+      }
       assert_msg(active_fd == 1 , "poll() returned an unexpected value");
-      return MEMCACHED_SUCCESS;
+      
+      if (fds.revents & POLLIN or fds.revents & POLLOUT)
+      {
+        return MEMCACHED_SUCCESS;
+      }
+
+      return memcached_set_error(*ptr, MEMCACHED_FAILURE, MEMCACHED_AT, memcached_literal_param("poll() returned a value that was not dealt with"));
     }
     else if (active_fd == 0)
     {