/* On all failure drop to returning NULL */
if (rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED)
{
- uint8_t latch; /* We use latch to track the state of the original socket */
-
if (rc == MEMCACHED_BUFFERED)
{
+ uint8_t latch; /* We use latch to track the state of the original socket */
latch= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS);
if (latch == 0)
memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1);
- }
- rc= memcached_set(ptr, key, key_length,
- memcached_result_value(&ptr->result),
- memcached_result_length(&ptr->result),
- 0, memcached_result_flags(&ptr->result));
+ rc= memcached_set(ptr, key, key_length,
+ memcached_result_value(&ptr->result),
+ memcached_result_length(&ptr->result),
+ 0, memcached_result_flags(&ptr->result));
- if (rc == MEMCACHED_BUFFERED && latch == 0)
- memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 0);
+ if (rc == MEMCACHED_BUFFERED && latch == 0)
+ memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 0);
+ }
+ else
+ {
+ rc= memcached_set(ptr, key, key_length,
+ memcached_result_value(&ptr->result),
+ memcached_result_length(&ptr->result),
+ 0, memcached_result_flags(&ptr->result));
+ }
if (rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED)
{
WATCHPOINT_ASSERT(ptr->hosts[server_key].cursor_active == 1);
}
+ /* Only called when we have a prefix key */
+ if (ptr->prefix_key[0] != 0)
+ {
+ if ((memcached_io_write(&ptr->hosts[server_key], ptr->prefix_key, ptr->prefix_key_length, 0)) == -1)
+ {
+ memcached_server_response_reset(&ptr->hosts[server_key]);
+ rc= MEMCACHED_SOME_ERRORS;
+ continue;
+ }
+ }
+
if ((memcached_io_write(&ptr->hosts[server_key], keys[x], key_length[x], 0)) == -1)
{
memcached_server_response_reset(&ptr->hosts[server_key]);