Merge in code changes for all of the new parser.
[awesomized/libmemcached] / libmemcached / hosts.c
index 3efc675f094fbb517491b082373be2e1a98c1d04..992bd763d0b98e1afe59aa32f9d88740e840a897 100644 (file)
@@ -93,9 +93,9 @@ static int continuum_item_cmp(const void *t1, const void *t2)
   /* Why 153? Hmmm... */
   WATCHPOINT_ASSERT(ct1->value != 153);
   if (ct1->value == ct2->value)
-    return EXIT_SUCCESS;
+    return 0;
   else if (ct1->value > ct2->value)
-    return EXIT_FAILURE;
+    return 1;
   else
     return -1;
 }
@@ -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);
+}