+ }
+
+ ptr->cursor_server= 0;
+ *value_length= 0;
+ return NULL;
+}
+
+memcached_result_st *memcached_fetch_result(memcached_st *ptr,
+ memcached_result_st *result,
+ memcached_return *error)
+{
+ if (result == NULL)
+ result= memcached_result_create(ptr, NULL);
+
+ WATCHPOINT_ASSERT(result->value.is_allocated != MEMCACHED_USED);
+
+ while (ptr->cursor_server < ptr->number_of_hosts)
+ {
+ if (!ptr->hosts[ptr->cursor_server].cursor_active)
+ {
+ ptr->cursor_server++;
+ continue;
+ }
+
+ result->cas= 0; /* We do this so we do not send in any junk */
+ *error= memcached_value_fetch(ptr, result->key, &result->key_length,
+ &result->value,
+ &result->flags,
+ &result->cas,
+ ptr->cursor_server);
+
+ if (*error == MEMCACHED_END) /* END means that we move on to the next */
+ {
+ ptr->hosts[ptr->cursor_server].cursor_active= 0;
+ ptr->cursor_server++;
+ continue;
+ }
+ else if (*error == MEMCACHED_SUCCESS)
+ return result;