483b177249ae2e956f4a0f56872e0f146f3ae5e2
4 This closes all connections (forces flush of input as well).
6 Maybe add a host specific, or key specific version?
8 The reason we send "quit" is that in case we have buffered IO, this
9 will force data to be completed.
12 void memcached_quit_server(memcached_st
*ptr
, unsigned int server_key
)
14 if (ptr
->hosts
== NULL
||
15 ptr
->number_of_hosts
== 0 ||
16 server_key
> ptr
->number_of_hosts
)
19 if (ptr
->hosts
[server_key
].fd
!= -1)
22 rc
= memcached_do(ptr
, server_key
, "quit\r\n", 6, 1);
23 WATCHPOINT_ASSERT(rc
== MEMCACHED_SUCCESS
);
25 memcached_io_close(ptr
, server_key
);
26 ptr
->hosts
[server_key
].fd
= -1;
27 ptr
->hosts
[server_key
].stack_responses
= 0;
28 ptr
->hosts
[server_key
].cursor_active
= 0;
29 ptr
->hosts
[server_key
].write_buffer_offset
= 0;
30 ptr
->hosts
[server_key
].read_buffer_length
= 0;
31 ptr
->hosts
[server_key
].read_ptr
= ptr
->hosts
[server_key
].read_buffer
;
32 ptr
->hosts
[server_key
].write_ptr
= ptr
->hosts
[server_key
].write_buffer
;
38 void memcached_quit(memcached_st
*ptr
)
42 if (ptr
->hosts
&& ptr
->number_of_hosts
)
44 for (x
= 0; x
< ptr
->number_of_hosts
; x
++)
45 memcached_quit_server(ptr
, x
);