From 9caad97a2b8b11488b2ba3583922864ac3ccbb09 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Tue, 8 Jan 2008 12:00:21 -0800 Subject: [PATCH] Kevin Dalley's patch for EOF --- lib/memcached_io.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/memcached_io.c b/lib/memcached_io.c index 05974ed5..299d4390 100644 --- a/lib/memcached_io.c +++ b/lib/memcached_io.c @@ -83,6 +83,7 @@ ssize_t memcached_io_read(memcached_st *ptr, unsigned int server_key, while (length) { + uint8_t found_eof= 0; if (!ptr->hosts[server_key].read_buffer_length) { size_t data_read; @@ -120,7 +121,11 @@ ssize_t memcached_io_read(memcached_st *ptr, unsigned int server_key, break; /* If zero, just keep looping unless testing, then assert() */ else + { WATCHPOINT_ASSERT(0); + found_eof= 1; + break; + } } ptr->hosts[server_key].read_data_length= data_read; @@ -148,6 +153,9 @@ ssize_t memcached_io_read(memcached_st *ptr, unsigned int server_key, ptr->hosts[server_key].read_buffer_length--; buffer_ptr++; } + + if (found_eof) + break; } return (size_t)(buffer_ptr - buffer); -- 2.30.2