X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fmemcached_quit.c;h=9874bb6ea45f66ad9a1876dabf7ae729ea53e633;hb=0d688cec9e53a2ed8e3f3817da9aecdd41d342ca;hp=366f7872cd76a229a3d547eb43e43ca683e8c691;hpb=74b5061e4b97edfed3b58f94bd594321e9ae425a;p=awesomized%2Flibmemcached diff --git a/lib/memcached_quit.c b/lib/memcached_quit.c index 366f7872..9874bb6e 100644 --- a/lib/memcached_quit.c +++ b/lib/memcached_quit.c @@ -16,9 +16,23 @@ void memcached_quit_server(memcached_server_st *ptr, uint8_t io_death) if (io_death == 0) { memcached_return rc; + ssize_t read_length; + char buffer[MEMCACHED_MAX_BUFFER]; + rc= memcached_do(ptr, "quit\r\n", 6, 1); WATCHPOINT_ASSERT(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_FETCH_NOTFINISHED); + /* read until socket is closed, or there is an error + * closing the socket before all data is read + * results in server throwing away all data which is + * not read + */ + while ((read_length= + memcached_io_read(ptr, buffer, sizeof(buffer)/sizeof(*buffer))) + > 0) + { + ; + } memcached_io_close(ptr); }