projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Testing to make sure that partial reads do not break protocol (aka on active
[awesomized/libmemcached]
/
lib
/
memcached_quit.c
diff --git
a/lib/memcached_quit.c
b/lib/memcached_quit.c
index 7670b06caabbf2bdaafd84cb1126fa0e179c28f8..e51692fcd7fbf9fc99170f818a03f01321145c4a 100644
(file)
--- a/
lib/memcached_quit.c
+++ b/
lib/memcached_quit.c
@@
-11,6
+11,11
@@
void memcached_quit_server(memcached_st *ptr, unsigned int server_key)
{
void memcached_quit_server(memcached_st *ptr, unsigned int server_key)
{
+ if (ptr->hosts == NULL ||
+ ptr->number_of_hosts == 0 ||
+ server_key > ptr->number_of_hosts)
+ return;
+
if (ptr->hosts[server_key].fd != -1)
{
if (ptr->flags & MEM_NO_BLOCK && ptr->hosts[server_key].stack_responses)
if (ptr->hosts[server_key].fd != -1)
{
if (ptr->flags & MEM_NO_BLOCK && ptr->hosts[server_key].stack_responses)
@@
-22,6
+27,9
@@
void memcached_quit_server(memcached_st *ptr, unsigned int server_key)
ptr->hosts[server_key].fd= -1;
ptr->hosts[server_key].stack_responses= 0;
ptr->hosts[server_key].cursor_active= 0;
ptr->hosts[server_key].fd= -1;
ptr->hosts[server_key].stack_responses= 0;
ptr->hosts[server_key].cursor_active= 0;
+ ptr->hosts[server_key].write_buffer_offset= 0;
+ ptr->hosts[server_key].read_buffer_length= 0;
+ ptr->hosts[server_key].read_ptr= ptr->hosts[server_key].read_buffer;
}
ptr->connected--;
}
ptr->connected--;
@@
-31,7
+39,7
@@
void memcached_quit(memcached_st *ptr)
{
unsigned int x;
{
unsigned int x;
- if (ptr->hosts)
+ if (ptr->hosts
&& ptr->number_of_hosts
)
{
for (x= 0; x < ptr->number_of_hosts; x++)
memcached_quit_server(ptr, x);
{
for (x= 0; x < ptr->number_of_hosts; x++)
memcached_quit_server(ptr, x);