2 +--------------------------------------------------------------------+
3 | libmemcached - C/C++ Client Library for memcached |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted under the terms of the BSD license. |
7 | You should have received a copy of the license in a bundled file |
8 | named LICENSE; in case you did not receive a copy you can review |
9 | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
10 +--------------------------------------------------------------------+
11 | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
12 | Copyright (c) 2020 Michael Wallner <mike@php.net> |
13 +--------------------------------------------------------------------+
16 #include "libmemcached/common.h"
18 memcached_return_t
memcached_flush_buffers(memcached_st
*shell
) {
19 Memcached
*memc
= memcached2Memcached(shell
);
21 memcached_return_t ret
= MEMCACHED_SUCCESS
;
23 for (uint32_t x
= 0; x
< memcached_server_count(memc
); ++x
) {
24 memcached_instance_st
*instance
= memcached_instance_fetch(memc
, x
);
26 if (instance
->write_buffer_offset
) {
27 if (instance
->fd
== INVALID_SOCKET
28 and (ret
= memcached_connect(instance
)) != MEMCACHED_SUCCESS
) {
29 WATCHPOINT_ERROR(ret
);
33 if (memcached_io_write(instance
) == false) {
34 ret
= MEMCACHED_SOME_ERRORS
;
42 return MEMCACHED_INVALID_ARGUMENTS
;