Update all config.h usage.
[m6w6/libmemcached] / libtest / memcached.cc
index b8838a06a495bd4bbdf8702daf523e1d1953600d..7d7920751c9bf8b66508d630a7a8c9d2f45e2cdf 100644 (file)
@@ -34,7 +34,7 @@
  *
  */
 
-#include <config.h>
+#include "mem_config.h"
 #include <libtest/common.h>
 
 #include <libmemcached-1.0/memcached.h>
@@ -97,6 +97,7 @@ public:
     libtest::Server(host_arg, port_arg,
                     MEMCACHED_BINARY, is_memcached_libtool(), is_socket_arg)
   {
+    set_pid_file();
   }
 
   virtual const char *sasl() const
@@ -114,31 +115,24 @@ public:
     return _username;
   }
 
-  virtual bool has_pid_file() const
+  bool wait_for_pidfile() const
   {
-    return false;
+    Wait wait(pid(), 4);
+
+    return wait.successful();
   }
 
   bool ping()
   {
-    memcached_return_t rc;
-    bool ret;
-
-    if (has_socket())
-    {
-      ret= libmemcached_util_ping(socket().c_str(), 0, &rc);
-    }
-    else
+    if (out_of_ban_killed())
     {
-      ret= libmemcached_util_ping(hostname().c_str(), port(), &rc);
+      return false;
     }
 
-    if (memcached_failed(rc) or ret == false)
-    {
-      error(memcached_strerror(NULL, rc));
-    }
+    SimpleClient client(_hostname, _port);
 
-    return ret;
+    std::string response;
+    return client.send_message("version", response);
   }
 
   const char *name()
@@ -360,7 +354,7 @@ bool Memcached::build(size_t argc, const char *argv[])
     add_option(sasl());
   }
 
-  for (int x= 0 ; x < argc ; x++)
+  for (size_t x= 0 ; x < argc ; x++)
   {
     add_option(argv[x]);
   }