Update pandora
[m6w6/libmemcached] / libmemcached / memcached_flush_buffers.c
1 #include "common.h"
2 #include "memcached_io.h"
3
4 memcached_return memcached_flush_buffers(memcached_st *mem)
5 {
6 memcached_return ret= MEMCACHED_SUCCESS;
7
8 for (uint32_t x= 0; x < mem->number_of_hosts; ++x)
9 if (mem->hosts[x].write_buffer_offset != 0)
10 {
11 if (mem->hosts[x].fd == -1 &&
12 (ret= memcached_connect(&mem->hosts[x])) != MEMCACHED_SUCCESS)
13 {
14 WATCHPOINT_ERROR(ret);
15 return ret;
16 }
17 if (memcached_io_write(&mem->hosts[x], NULL, 0, 1) == -1)
18 ret= MEMCACHED_SOME_ERRORS;
19 }
20
21 return ret;
22 }