*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <libmemcached-1.0/memcached.h>
bool ping()
{
-#if 0
- // Memcached is slow to start, so we need to do this
- if (pid_file().empty() == false)
+ if (out_of_ban_killed())
{
- if (wait_for_pidfile() == false)
- {
- Error << "Pidfile was not found:" << pid_file() << " :" << running();
- return -1;
- }
+ return false;
}
-#endif
-
- memcached_return_t rc;
- bool ret;
- if (has_socket())
- {
- ret= libmemcached_util_ping(socket().c_str(), 0, &rc);
- }
- else
- {
- ret= libmemcached_util_ping(hostname().c_str(), port(), &rc);
- }
+ SimpleClient client(_hostname, _port);
- if (memcached_failed(rc) or ret == false)
- {
- Error << "libmemcached_util_ping(" << hostname() << ", " << port() << ") error: " << memcached_strerror(NULL, rc);
- }
-
- return ret;
+ std::string response;
+ return client.send_message("version", response);
}
const char *name()
bool ping()
{
- // Memcached is slow to start, so we need to do this
- if (pid_file().empty() == false)
- {
- if (wait_for_pidfile() == false)
- {
- Error << "Pidfile was not found:" << pid_file();
- return -1;
- }
- }
-
memcached_return_t rc;
bool ret;
if (memcached_failed(rc) or ret == false)
{
- Error << "libmemcached_util_ping2(" << hostname() << ", " << port() << ", " << username() << ", " << password() << ") error: " << memcached_strerror(NULL, rc);
+ error(memcached_strerror(NULL, rc));
}
return ret;
}
add_option("-l", "localhost");
+#ifndef TARGET_OS_OSX
add_option("-m", "128");
add_option("-M");
+#endif
if (sasl())
{
add_option(sasl());
}
- for (int x= 0 ; x < argc ; x++)
+ for (size_t x= 0 ; x < argc ; x++)
{
add_option(argv[x]);
}