Fix Trond's email address.
[m6w6/libmemcached] / libmemcached / verbosity.c
1 #include "common.h"
2
3 memcached_return_t memcached_verbosity(memcached_st *ptr, unsigned int verbosity)
4 {
5 unsigned int x;
6 size_t send_length;
7 memcached_return_t rc;
8 char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
9
10 send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
11 "verbosity %u\r\n", verbosity);
12 unlikely (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_t 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 unlikely (ptr->flags.use_udp)
28 continue;
29
30 rrc= memcached_response(&ptr->hosts[x], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
31 if (rrc != MEMCACHED_SUCCESS)
32 rc= MEMCACHED_SOME_ERRORS;
33 }
34
35 return rc;
36 }