Additional fixes/test. We will now limit the hostname when adding it into
[m6w6/libmemcached] / libmemcached / hosts.c
index 3efc675f094fbb517491b082373be2e1a98c1d04..c861a6d9361ede3ff48c7aa5bc3cfccaaa321f9c 100644 (file)
@@ -450,3 +450,20 @@ static memcached_return_t server_add(memcached_st *ptr, const char *hostname,
 
   return run_distribution(ptr);
 }
+
+memcached_return_t memcached_server_add_parsed(memcached_st *ptr,
+                                               const char *hostname,
+                                               size_t hostname_length,
+                                               in_port_t port,
+                                               uint32_t weight)
+{
+  char buffer[NI_MAXHOST];
+
+  memcpy(buffer, hostname, hostname_length);
+  buffer[hostname_length]= 0;
+
+  return server_add(ptr, buffer,
+                    port,
+                    weight,
+                    MEMCACHED_CONNECTION_TCP);
+}