- /* we have already incremented the response counter, and memcached_response
- will read out all messages.. To avoid memcached_response to wait forever
- for a response to a command I have in my buffer, let's decrement the
- response counter :) */
- memcached_server_response_decrement(ptr);
-
- /* memcached_response may call memcached_io_read, but let's use a short
- timeout if there is no data yet */
- timeout= ptr->root->poll_timeout;
- ptr->root->poll_timeout= 1;
- result_ptr= memcached_result_create(ptr->root, &result);
-
- if (result_ptr == NULL)
- return MEMCACHED_FAILURE;
+ uint32_t no_msg= memcached_server_response_count(ptr) - 1;
+ if (no_msg > 0)
+ {
+ memcached_result_st result;
+ memcached_result_st *result_ptr;
+ char buffer[SMALL_STRING_LEN];
+
+ /*
+ * We need to increase the timeout, because we might be waiting for
+ * data to be sent from the server (the commands was in the output buffer
+ * and just flushed
+ */
+ int32_t timeo= ptr->root->poll_timeout;
+ ptr->root->poll_timeout= 2000;