MEMCACHED_BAD_KEY_PROVIDED has been added as an error type. When libmemcached
[m6w6/libmemcached] / lib / memcached_verbosity.c
1 #include "common.h"
2
3 memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbosity)
4 {
5 unsigned int x;
6 size_t send_length;
7 memcached_return rc;
8 char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
9
10 send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
11 "verbosity %u\r\n", verbosity);
12 if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
13 return MEMCACHED_WRITE_FAILURE;
14
15 rc= MEMCACHED_SUCCESS;
16 for (x= 0; x < ptr->number_of_hosts; x++)
17 {
18 memcached_return rrc;
19
20 rrc= memcached_do(&ptr->hosts[x], buffer, send_length, 1);
21 if (rrc != MEMCACHED_SUCCESS)
22 {
23 rc= MEMCACHED_SOME_ERRORS;
24 continue;
25 }
26
27 rrc= memcached_response(&ptr->hosts[x], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
28 if (rrc != MEMCACHED_SUCCESS)
29 rc= MEMCACHED_SOME_ERRORS;
30 }
31
32 return rc;
33 }