From 262486489d4dec5f7af6046a27b9e6b337b45ea9 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Tue, 12 Jun 2012 20:58:18 -0700 Subject: [PATCH] Diligently check poll() a bit more. Also determine number of servers based on cores available. --- libmemcached/io.cc | 8 +++++++- tests/libmemcached-1.0/all_tests.cc | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libmemcached/io.cc b/libmemcached/io.cc index 56239529..b08473a0 100644 --- a/libmemcached/io.cc +++ b/libmemcached/io.cc @@ -218,7 +218,13 @@ static memcached_return_t io_wait(memcached_server_write_instance_st ptr, 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) { diff --git a/tests/libmemcached-1.0/all_tests.cc b/tests/libmemcached-1.0/all_tests.cc index 4d4d4ca8..2efbdf27 100644 --- a/tests/libmemcached-1.0/all_tests.cc +++ b/tests/libmemcached-1.0/all_tests.cc @@ -79,7 +79,8 @@ void get_world(Framework *world) } else { - world->servers().set_servers_to_run(8); + world->servers().set_servers_to_run(libtest::number_of_cpus() > 3 ? + libtest::number_of_cpus() : 3); } world->collections(collection); -- 2.30.2