/* Send command header */
memcached_return_t rc= memcached_vdo(instance, vector, 12, flush);
- if (rc == MEMCACHED_SUCCESS)
+
+ // If we should not reply, return with MEMCACHED_SUCCESS, unless error
+ if (reply == false)
{
- if (flush == false)
- {
- return MEMCACHED_BUFFERED;
- }
+ return memcached_success(rc) ? MEMCACHED_SUCCESS : rc;
+ }
- if (reply == false)
- {
- return MEMCACHED_SUCCESS;
- }
+ if (flush == false)
+ {
+ return memcached_success(rc) ? MEMCACHED_BUFFERED : rc;
+ }
+ if (rc == MEMCACHED_SUCCESS)
+ {
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
- rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
+ rc= memcached_response(instance, buffer, sizeof(buffer), NULL);
if (rc == MEMCACHED_STORED)
{
return rc;
}
- if (memcached_failed(rc= memcached_validate_key_length(key_length, memcached_is_binary(ptr))))
+ if (memcached_failed(rc= memcached_key_test(*ptr, (const char **)&key, &key_length, 1)))
{
return rc;
}
- if (memcached_failed(memcached_key_test(*ptr, (const char **)&key, &key_length, 1)))
- {
- return MEMCACHED_BAD_KEY_PROVIDED;
- }
-
uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
memcached_server_write_instance_st instance= memcached_server_instance_fetch(ptr, server_key);