From: Brian Aker Date: Tue, 14 Jun 2011 13:29:45 +0000 (-0700) Subject: Remove assert. X-Git-Tag: 0.51~4^2~16 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=249c2816f88de9b20a63eb4330646eaf050183ac;p=awesomized%2Flibmemcached Remove assert. --- diff --git a/libmemcached/connect.cc b/libmemcached/connect.cc index 707f7344..dc9f0df0 100644 --- a/libmemcached/connect.cc +++ b/libmemcached/connect.cc @@ -112,6 +112,7 @@ static memcached_return_t connect_poll(memcached_server_st *ptr) ptr->cached_errno= get_socket_errno(); } + WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET); (void)closesocket(ptr->fd); ptr->fd= INVALID_SOCKET; ptr->state= MEMCACHED_SERVER_STATE_NEW; @@ -127,7 +128,7 @@ static memcached_return_t connect_poll(memcached_server_st *ptr) static memcached_return_t set_hostinfo(memcached_server_st *server) { - assert(! server->address_info); // We cover the case where a programming mistake has been made. + WATCHPOINT_ASSERT(not server->address_info); // We cover the case where a programming mistake has been made. if (server->address_info) { freeaddrinfo(server->address_info); @@ -482,6 +483,7 @@ static memcached_return_t network_connect(memcached_server_st *ptr) break; case EINTR: // Special case, we retry ai_addr + WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET); (void)closesocket(ptr->fd); ptr->fd= INVALID_SOCKET; ptr->state= MEMCACHED_SERVER_STATE_NEW; @@ -491,6 +493,7 @@ static memcached_return_t network_connect(memcached_server_st *ptr) break; } + WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET); (void)closesocket(ptr->fd); ptr->fd= INVALID_SOCKET; ptr->address_info_next= ptr->address_info_next->ai_next; @@ -592,11 +595,12 @@ memcached_return_t memcached_connect(memcached_server_write_instance_st ptr) case MEMCACHED_CONNECTION_TCP: rc= network_connect(ptr); #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT - if (ptr->fd != INVALID_SOCKET && ptr->root->sasl.callbacks) + if (ptr->fd != INVALID_SOCKET and ptr->root->sasl.callbacks) { rc= memcached_sasl_authenticate_connection(ptr); - if (memcached_failed(rc)) + if (memcached_failed(rc) and ptr->fd != INVALID_SOCKET) { + WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET); (void)closesocket(ptr->fd); ptr->fd= INVALID_SOCKET; } diff --git a/libmemcached/io.cc b/libmemcached/io.cc index 40aaec20..7f734e44 100644 --- a/libmemcached/io.cc +++ b/libmemcached/io.cc @@ -478,11 +478,11 @@ ssize_t memcached_io_writev(memcached_server_write_instance_st ptr, } -memcached_return_t memcached_io_close(memcached_server_write_instance_st ptr) +void memcached_io_close(memcached_server_write_instance_st ptr) { if (ptr->fd == INVALID_SOCKET) { - return MEMCACHED_SUCCESS; + return; } /* in case of death shutdown to avoid blocking at close() */ @@ -499,8 +499,6 @@ memcached_return_t memcached_io_close(memcached_server_write_instance_st ptr) } ptr->state= MEMCACHED_SERVER_STATE_NEW; ptr->fd= INVALID_SOCKET; - - return MEMCACHED_SUCCESS; } memcached_server_write_instance_st memcached_io_get_readable_server(memcached_st *memc) diff --git a/libmemcached/io.h b/libmemcached/io.h index a5d34474..115692d0 100644 --- a/libmemcached/io.h +++ b/libmemcached/io.h @@ -96,7 +96,7 @@ memcached_return_t memcached_io_readline(memcached_server_write_instance_st ptr, size_t size); LIBMEMCACHED_LOCAL -memcached_return_t memcached_io_close(memcached_server_write_instance_st ptr); +void memcached_io_close(memcached_server_write_instance_st ptr); /* Read n bytes of data from the server and store them in dta */ LIBMEMCACHED_LOCAL