From: Brian Aker Date: Sat, 12 Feb 2011 10:52:48 +0000 (-0800) Subject: Rollup of fixes/error message corrections in mget. This also remove the X-Git-Tag: 0.51~43 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=0f7a6d1cbcff19e7a48d18605b7d070758f34776;p=m6w6%2Flibmemcached Rollup of fixes/error message corrections in mget. This also remove the infinite wait on non-block. --- 0f7a6d1cbcff19e7a48d18605b7d070758f34776 diff --cc libmemcached/get.c index 8d76507c,876389bf..aa4e6f53 --- a/libmemcached/get.c +++ b/libmemcached/get.c @@@ -245,7 -250,8 +250,7 @@@ static memcached_return_t memcached_mge if ((memcached_io_writev(instance, vector, 4, false)) == -1) { - rc= MEMCACHED_SOME_ERRORS; - fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout); + failures_occured_in_sending= true; continue; } WATCHPOINT_ASSERT(instance->cursor_active == 0); @@@ -257,7 -263,8 +262,7 @@@ if ((memcached_io_writev(instance, (vector + 1), 3, false)) == -1) { memcached_server_response_reset(instance); - rc= MEMCACHED_SOME_ERRORS; - fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout); + failures_occured_in_sending= true; continue; } } @@@ -276,7 -295,12 +293,11 @@@ /* We need to do something about non-connnected hosts in the future */ if ((memcached_io_write(instance, "\r\n", 2, true)) == -1) { - rc= MEMCACHED_SOME_ERRORS; - fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout); + failures_occured_in_sending= true; + } + else + { + success_happened= true; } } } diff --cc libmemcached/io.c index bc74af7d,3b5d44f5..9f38af5c --- a/libmemcached/io.c +++ b/libmemcached/io.c @@@ -385,7 -383,10 +381,9 @@@ static ssize_t _io_write(memcached_serv buffer_end= MAX_UDP_DATAGRAM_LENGTH; should_write= length; if (ptr->write_buffer_offset + should_write > buffer_end) + { - fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout); return -1; + } } else { @@@ -574,7 -578,10 +574,9 @@@ static ssize_t io_flush(memcached_serve rc= memcached_purge(ptr); if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_STORED) + { - fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout); return -1; + } } ssize_t sent_length; size_t return_length; @@@ -587,7 -594,10 +589,9 @@@ // UDP Sanity check, make sure that we are not sending somthing too big if (ptr->type == MEMCACHED_CONNECTION_UDP && write_length > MAX_UDP_DATAGRAM_LENGTH) + { - fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout); return -1; + } if (ptr->write_buffer_offset == 0 || (ptr->type == MEMCACHED_CONNECTION_UDP && ptr->write_buffer_offset == UDP_DATAGRAM_HEADER_LENGTH)) @@@ -609,6 -619,7 +613,7 @@@ if (ptr->type == MEMCACHED_CONNECTION_UDP) increment_udp_message_id(ptr); - assert(ptr->fd != -1); ++ WATCHPOINT_ASSERT(ptr->fd != -1); sent_length= send(ptr->fd, local_write_ptr, write_length, 0); if (sent_length == SOCKET_ERROR) { @@@ -643,11 -654,17 +648,14 @@@ continue; memcached_quit_server(ptr, true); - fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout); return -1; } + case ENOTCONN: + case EPIPE: default: - fprintf(stderr, "%s %u %u %u\n", ptr->hostname, ptr->port, ptr->io_bytes_sent, ptr->server_failure_counter); - fprintf(stderr, "%s:%d (%s)(%s)\n", __FILE__, __LINE__,__func__, strerror(errno));fflush(stdout); memcached_quit_server(ptr, true); *error= MEMCACHED_ERRNO; - assert(ptr->fd == -1); ++ WATCHPOINT_ASSERT(ptr->fd == -1); return -1; } }