Try to setup initial DNS a bit earlier in the process so that we can make use of...
authorBrian Aker <brian@tangent.org>
Tue, 29 Nov 2011 19:41:49 +0000 (11:41 -0800)
committerBrian Aker <brian@tangent.org>
Tue, 29 Nov 2011 19:41:49 +0000 (11:41 -0800)
libmemcached/common.h
libmemcached/connect.cc
libmemcached/connect.hpp [new file with mode: 0644]
libmemcached/get.cc
libmemcached/include.am
libmemcached/initialize_query.cc
libmemcached/server.cc
libtest/run.gdb

index ba0b4063a068f9443e0a768faa9f16eeee4ed936..7239ca6076e8e5f044d10cf829876788d23b089e 100644 (file)
@@ -107,6 +107,7 @@ memcached_return_t memcached_server_execute(memcached_st *ptr,
 #include <libmemcached/io.hpp>
 #include <libmemcached/do.hpp>
 #include <libmemcached/close_socket.hpp>
+#include <libmemcached/connect.hpp>
 #endif
 #include <libmemcached/internal.h>
 #include <libmemcached/array.h>
index 6cad60d5ed4f942799d77f1edea8710e5725b1c7..e04098c421db19d6297958d875fd967c0ae715ca 100644 (file)
@@ -129,7 +129,7 @@ static memcached_return_t connect_poll(memcached_server_st *server)
   return memcached_set_errno(*server, get_socket_errno(), MEMCACHED_AT);
 }
 
-static memcached_return_t set_hostinfo(memcached_server_st *server)
+memcached_return_t set_hostinfo(memcached_server_st *server)
 {
   if (server->address_info)
   {
diff --git a/libmemcached/connect.hpp b/libmemcached/connect.hpp
new file mode 100644 (file)
index 0000000..78ed796
--- /dev/null
@@ -0,0 +1,40 @@
+/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ * 
+ *  Libmemcached library
+ *
+ *  Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ *
+ *      * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ *
+ *      * Redistributions in binary form must reproduce the above
+ *  copyright notice, this list of conditions and the following disclaimer
+ *  in the documentation and/or other materials provided with the
+ *  distribution.
+ *
+ *      * The names of its contributors may not be used to endorse or
+ *  promote products derived from this software without specific prior
+ *  written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+#pragma once
+
+memcached_return_t set_hostinfo(memcached_server_st *server);
index 6dfb7a79a271409902f88947e9d0cb870da5bc01..4ad49a41d00f8042b1c6ff9d1cde3be0dfb5edb0 100644 (file)
@@ -68,12 +68,16 @@ char *memcached_get_by_key(memcached_st *ptr,
 {
   memcached_return_t unused;
   if (error == NULL)
+  {
     error= &unused;
+  }
 
-  unlikely (ptr->flags.use_udp)
+  if (ptr->flags.use_udp)
   {
     if (value_length) 
+    {
       *value_length= 0;
+    }
 
     *error= memcached_set_error(*ptr, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT);
     return NULL;
index 0da3de330d7a06db80b005131ba7dbfb457a3465..69385463598c36e7ff988a7b06c23f6ba2712f14 100644 (file)
@@ -20,9 +20,10 @@ noinst_HEADERS+= \
                 libmemcached/assert.hpp \
                 libmemcached/backtrace.hpp \
                 libmemcached/byteorder.h \
+                libmemcached/close_socket.hpp \
                 libmemcached/common.h \
+                libmemcached/connect.hpp \
                 libmemcached/continuum.hpp \
-                libmemcached/close_socket.hpp \
                 libmemcached/do.hpp \
                 libmemcached/error.hpp \
                 libmemcached/initialize_query.h \
index 5950158b053feb22a6205ef825719d08277d04a3..84fc2290e647d8f3913d2e58915f59b735bdd043 100644 (file)
@@ -55,12 +55,14 @@ memcached_return_t initialize_query(memcached_st *self)
     return memcached_set_error(*self, MEMCACHED_NO_SERVERS, MEMCACHED_AT);
   }
 
+  memcached_error_free(*self);
+
   return MEMCACHED_SUCCESS;
 }
 
 memcached_return_t initialize_const_query(const memcached_st *self)
 {
-  if (not self)
+  if (self == NULL)
   {
     return MEMCACHED_INVALID_ARGUMENTS;
   }
index cf63f4ca4c7e34033cdb04c2d767e869c2d74047..e1b91b94ceab24c229ecc6b8a5c4e473b902652d 100644 (file)
@@ -138,6 +138,11 @@ memcached_server_st *__server_create_with(memcached_st *memc,
     memcached_io_init_udp_header(self, 0);
   }
 
+  if (memc)
+  {
+    set_hostinfo(self);
+  }
+
   return self;
 }
 
@@ -197,14 +202,6 @@ memcached_server_st *memcached_server_clone(memcached_server_st *destination,
                                     hostname,
                                     source->port, source->weight,
                                     source->type);
-  if (destination)
-  {
-    if (source->error_messages)
-    {
-      destination->error_messages= memcached_error_copy(*source);
-    }
-  }
-
   return destination;
 
 }
index 320407a23012715afb8d63f03c3dcaae9fc67e03..a520ae879361863cebb27bfa214010fa6b3ed26f 100644 (file)
@@ -1,2 +1,3 @@
 set environment LIBTEST_IN_GDB=1
 run
+quit