From: Brian Aker Date: Tue, 8 Jan 2008 20:00:21 +0000 (-0800) Subject: Kevin Dalley's patch for EOF X-Git-Tag: 0.13~7 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=9caad97a2b8b11488b2ba3583922864ac3ccbb09;p=awesomized%2Flibmemcached Kevin Dalley's patch for EOF --- 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);