89a55ecf43c96f0739152c1c851917d48bfd8c03
[awesomized/libmemcached] / lib / memcached_quit.c
1 #include "common.h"
2
3 /*
4 This closes all connections (forces flush of input as well).
5
6 Maybe add a host specific, or key specific version?
7 */
8 void memcached_quit(memcached_st *ptr)
9 {
10 unsigned int x;
11
12 if (ptr->hosts)
13 {
14 for (x= 0; x < ptr->number_of_hosts; x++)
15 {
16 if (ptr->hosts[x].fd != -1)
17 {
18 close(ptr->hosts[x].fd);
19 ptr->hosts[x].fd= -1;
20 }
21 }
22 }
23
24 ptr->connected= 0;
25 }