Fix on definition for memcached_execute_fetch().
[awesomized/libmemcached] / libmemcached / memcached_fetch_execute.c
1 #include "common.h"
2
3 memcached_return memcached_fetch_execute(memcached_st *ptr,
4 memcached_execute_function *callback,
5 void *context,
6 unsigned int number_of_callbacks)
7 {
8 memcached_result_st *result= &ptr->result;
9
10 while (ptr->cursor_server < ptr->number_of_hosts)
11 {
12 memcached_return rc;
13
14 char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
15
16 if (memcached_server_response_count(&ptr->hosts[ptr->cursor_server]) == 0)
17 {
18 ptr->cursor_server++;
19 continue;
20 }
21
22 rc= memcached_response(&ptr->hosts[ptr->cursor_server], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, result);
23
24 if (rc == MEMCACHED_END) /* END means that we move on to the next */
25 {
26 memcached_server_response_reset(&ptr->hosts[ptr->cursor_server]);
27 ptr->cursor_server++;
28 continue;
29 }
30 else if (rc == MEMCACHED_SUCCESS)
31 {
32 unsigned int x;
33
34 for (x= 0; x < number_of_callbacks; x++)
35 {
36 memcached_return iferror;
37
38 iferror= (*callback[x])(ptr, result, context);
39
40 if (iferror != MEMCACHED_SUCCESS)
41 continue;
42 }
43 }
44 }
45
46 return MEMCACHED_SUCCESS;
47 }