From: Brian Aker Date: Fri, 20 May 2011 15:35:32 +0000 (-0700) Subject: Small cleanups in the error messages. X-Git-Tag: 0.51~10^2~8 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=054727552b914a95ebbefed9798d1e558d59c86c;p=m6w6%2Flibmemcached Small cleanups in the error messages. --- diff --git a/libmemcached/connect.cc b/libmemcached/connect.cc index 1d95fd45..0b77c7a8 100644 --- a/libmemcached/connect.cc +++ b/libmemcached/connect.cc @@ -37,9 +37,9 @@ #include -#include +#include +#include #include -#include static memcached_return_t connect_poll(memcached_server_st *ptr) { @@ -358,8 +358,7 @@ static memcached_return_t unix_socket_connect(memcached_server_st *ptr) if ((ptr->fd= socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - ptr->cached_errno= errno; - return MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE; + return memcached_set_errno(*ptr, errno, NULL); } struct sockaddr_un servAddr; @@ -388,7 +387,7 @@ test_connect: } } - WATCHPOINT_ASSERT(ptr->fd != -1); + WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET); return MEMCACHED_SUCCESS; #else @@ -441,9 +440,7 @@ static memcached_return_t network_connect(memcached_server_st *ptr) ptr->address_info_next->ai_socktype, ptr->address_info_next->ai_protocol)) < 0) { - ptr->cached_errno= get_socket_errno(); - WATCHPOINT_ERRNO(get_socket_errno()); - return MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE; + return memcached_set_errno(*ptr, get_socket_errno(), NULL); } (void)set_socket_options(ptr); @@ -582,7 +579,7 @@ memcached_return_t memcached_connect(memcached_server_write_instance_st ptr) if (ptr->fd != INVALID_SOCKET && ptr->root->sasl.callbacks) { rc= memcached_sasl_authenticate_connection(ptr); - if (rc != MEMCACHED_SUCCESS) + if (memcached_failed(rc)) { (void)closesocket(ptr->fd); ptr->fd= INVALID_SOCKET; diff --git a/libmemcached/strerror.cc b/libmemcached/strerror.cc index 39583152..682072c1 100644 --- a/libmemcached/strerror.cc +++ b/libmemcached/strerror.cc @@ -27,7 +27,7 @@ const char *memcached_strerror(memcached_st *ptr, memcached_return_t rc) return "SERVER ERROR"; case MEMCACHED_WRITE_FAILURE: return "WRITE FAILURE"; - case MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE: + case MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE: // DEPRECATED return "CONNECTION SOCKET CREATE FAILURE"; case MEMCACHED_DATA_EXISTS: return "CONNECTION DATA EXISTS";