{ key, key_length }
};
- memcached_return_t rc;
- if (memcached_fatal(rc= memcached_vdo(instance, vector, 4, should_flush)))
- {
- assert(memcached_last_error(instance->root) != MEMCACHED_SUCCESS);
- memcached_io_reset(instance);
- }
+ memcached_return_t rc= memcached_vdo(instance, vector, 4, should_flush);
if (memcached_has_replicas(instance))
{
memcached_instance_st* replica= memcached_instance_fetch(instance->root, server_key);
- if (memcached_fatal(memcached_vdo(replica, vector, 4, should_flush)))
- {
- assert(memcached_last_error(instance->root) != MEMCACHED_SUCCESS);
- memcached_io_reset(replica);
- }
- else
+ if (memcached_success(memcached_vdo(replica, vector, 4, should_flush)))
{
memcached_server_response_decrement(replica);
}
** before they start writing, if there is any data in buffer, clear it out,
** otherwise we might get a partial write.
**/
+ bool sent_success;
if (memcached_is_udp(instance->root))
{
- return _vdo_udp(instance, vector, count);
+ sent_success= memcached_success(rc= _vdo_udp(instance, vector, count));
+ } else {
+ sent_success= memcached_io_writev(instance, vector, count, with_flush);
}
-
- bool sent_success= memcached_io_writev(instance, vector, count, with_flush);
if (sent_success == false)
{
- //assert(memcached_last_error(instance->root) == MEMCACHED_SUCCESS);
- if (memcached_last_error(instance->root) == MEMCACHED_SUCCESS)
- {
- //assert(memcached_last_error(instance->root) != MEMCACHED_SUCCESS);
- return memcached_set_error(*instance, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
- }
- else
+ rc= memcached_last_error(instance->root);
+ if (rc == MEMCACHED_SUCCESS)
{
- rc= memcached_last_error(instance->root);
+ memcached_set_error(*instance, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
}
+ memcached_io_reset(instance);
}
- else if (memcached_is_replying(instance->root))
+ else if (memcached_is_replying(instance->root) && !memcached_is_udp(instance->root))
{
memcached_server_response_increment(instance);
}
memcached_instance_st* instance= memcached_instance_fetch(memc, server_key);
memcached_return_t vdo_rc;
- if (memcached_success((vdo_rc= memcached_vdo(instance, vector, 3, true))))
- {
- // We have sent the message to the server successfully
- }
- else
+ if (memcached_failed((vdo_rc= memcached_vdo(instance, vector, 3, true))))
{
return vdo_rc;
}
rc= ascii_exist(memc, instance, key, key_length);
}
- if (memcached_fatal(rc))
- {
- memcached_io_reset(instance);
- }
-
return rc;
}
{
memcached_set_error(*instance, rrc, MEMCACHED_AT);
}
- memcached_io_reset(instance);
rc= MEMCACHED_SOME_ERRORS;
}
}
*/
if (memcached_io_write(ptr) == false)
{
+ memcached_io_reset(ptr);
memcached_set_error(*ptr, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
return false;
}
if (rc== MEMCACHED_PROTOCOL_ERROR or rc == MEMCACHED_UNKNOWN_READ_FAILURE or rc == MEMCACHED_READ_FAILURE)
{
WATCHPOINT_ERROR(rc);
- memcached_io_reset(ptr);
is_successful= false;
}
{
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
protocol_binary_request_stats request= {}; // = {.bytes= {0}};
+ memcached_return_t rc;
initialize_binary_request(instance, request.message.header);
{ args, args_length }
};
- if (memcached_vdo(instance, vector, 2, true) != MEMCACHED_SUCCESS)
+ if (memcached_failed(rc = memcached_vdo(instance, vector, 2, true)))
{
- memcached_io_reset(instance);
- return MEMCACHED_WRITE_FAILURE;
+ return rc;
}
}
else
{ request.bytes, sizeof(request.bytes) }
};
- if (memcached_vdo(instance, vector, 1, true) != MEMCACHED_SUCCESS)
+ if (memcached_failed(rc = memcached_vdo(instance, vector, 1, true)))
{
- memcached_io_reset(instance);
- return MEMCACHED_WRITE_FAILURE;
+ return rc;
}
}
memcached_server_response_decrement(instance);
while (1)
{
- memcached_return_t rc= memcached_response(instance, buffer, sizeof(buffer), NULL);
+ rc= memcached_response(instance, buffer, sizeof(buffer), NULL);
if (rc == MEMCACHED_END)
{
if (rc != MEMCACHED_SUCCESS)
{
- memcached_io_reset(instance);
return rc;
}
memcached_return_t rc;
if ((rc= memcached_vdo(server, vector, 5, flush)) != MEMCACHED_SUCCESS)
{
- memcached_io_reset(server);
-
-#if 0
- if (memcached_has_error(ptr))
- {
- memcached_set_error(*server, rc, MEMCACHED_AT);
- }
-#endif
-
assert(memcached_last_error(server->root) != MEMCACHED_SUCCESS);
return memcached_last_error(server->root);
}
memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key);
- if (memcached_vdo(instance, vector, 5, false) != MEMCACHED_SUCCESS)
- {
- memcached_io_reset(instance);
- }
- else
+ if (memcached_success(memcached_vdo(instance, vector, 5, false)))
{
memcached_server_response_decrement(instance);
}
}
}
- if (rc == MEMCACHED_WRITE_FAILURE)
- {
- memcached_io_reset(instance);
- }
-
assert(memcached_failed(rc));
#if 0
if (memcached_has_error(ptr) == false)
memcached_return_t rc;
if (memcached_failed(rc= memcached_vdo(instance, vector, 6, true)))
{
- memcached_io_reset(instance);
return memcached_set_error(*instance, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
}
memcached_return_t rc;
if (memcached_failed(rc= memcached_vdo(instance, vector, 4, true)))
{
- memcached_io_reset(instance);
return memcached_set_error(*instance, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
}
memcached_return_t rrc= memcached_response(instance, NULL);
if (memcached_failed(rrc))
{
- memcached_io_reset(instance);
errors_happened= true;
}
}
memcached_return_t rrc= memcached_vdo(instance, vector, 1, true);
if (memcached_failed(rrc))
{
- memcached_io_reset(instance);
errors_happened= true;
continue;
}
memcached_return_t rrc= memcached_response(instance, buffer, sizeof(buffer), NULL);
if (memcached_failed(rrc))
{
- memcached_io_reset(instance);
errors_happened= true;
}
}