do function should not increment response counter in no reply mode
[awesomized/libmemcached] / libmemcached / memcached_do.c
1 #include "common.h"
2
3 memcached_return memcached_do(memcached_server_st *ptr, const void *command,
4 size_t command_length, uint8_t with_flush)
5 {
6 memcached_return rc;
7 ssize_t sent_length;
8
9 WATCHPOINT_ASSERT(command_length);
10 WATCHPOINT_ASSERT(command);
11
12 if ((rc= memcached_connect(ptr)) != MEMCACHED_SUCCESS)
13 {
14 WATCHPOINT_ERROR(rc);
15 return rc;
16 }
17
18 sent_length= memcached_io_write(ptr, command, command_length, with_flush);
19
20 if (sent_length == -1 || (size_t)sent_length != command_length)
21 rc= MEMCACHED_WRITE_FAILURE;
22 else if ((ptr->root->flags & MEM_NOREPLY) == 0)
23 memcached_server_response_increment(ptr);
24
25 return rc;
26 }