- memcached_quit_server(instance, true);
-
- if (memcached_has_error(instance)) {
- return memcached_instance_error_return(instance);
+static memcached_return_t io_wait(memcached_instance_st *instance, const short events) {
+ if (events & POLLOUT) {
+ /*
+ ** We are going to block on write, but at least on Solaris we might block
+ ** on write if we haven't read anything from our input buffer..
+ ** Try to purge the input buffer if we don't do any flow control in the
+ ** application layer (just sending a lot of data etc)
+ ** The test is moved down in the purge function to avoid duplication of
+ ** the test.
+ */
+ if (memcached_purge(instance) == false) {
+ return MEMCACHED_FAILURE;
+ }
+ instance->io_wait_count.write++;
+ } else {
+ instance->io_wait_count.read++;