return false;
}
+ (void)memcached_behavior_set(memc_ptr, MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT, 400000);
+
memcached_return_t rc= memcached_server_add(memc_ptr, hostname, port);
if (memcached_success(rc))
{
libtest::Server(host_arg, port_arg,
MEMCACHED_BINARY, is_memcached_libtool(), is_socket_arg)
{
- set_pid_file();
}
virtual const char *sasl() const
return _username;
}
- bool wait_for_pidfile() const
+ virtual bool has_pid_file() const
{
- Wait wait(pid(), 4);
-
- return wait.successful();
+ return false;
}
bool ping()
{
-#if 0
- // 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() << " :" << running();
- return -1;
- }
- }
-#endif
-
memcached_return_t rc;
bool ret;
if (memcached_failed(rc) or ret == false)
{
- Error << "libmemcached_util_ping(" << hostname() << ", " << port() << ") error: " << memcached_strerror(NULL, rc);
+ error(memcached_strerror(NULL, rc));
}
return ret;
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;
bool Server::wait_for_pidfile() const
{
- Wait wait(pid_file(), 4);
+ if (has_pid_file())
+ {
+ Wait wait(pid_file(), 4);
+
+ return wait.successful();
+ }
- return wait.successful();
+ return true;
}
bool Server::has_pid() const
dream(5, 50000);
}
- size_t repeat= 5;
_app.slurp();
- while (--repeat)
+ if (has_pid_file())
{
- if (pid_file().empty() == false)
+ size_t repeat= 5;
+ while (--repeat)
{
- Wait wait(pid_file(), 8);
-
- if (wait.successful() == false)
+ if (pid_file().empty() == false)
{
- if (_app.check())
+ Error << " here?";
+ Wait wait(pid_file(), 8);
+
+ if (wait.successful() == false)
{
- _app.slurp();
- continue;
+ if (_app.check())
+ {
+ _app.slurp();
+ continue;
+ }
+
+ char buf[PATH_MAX];
+ char *getcwd_buf= getcwd(buf, sizeof(buf));
+ throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
+ "Unable to open pidfile in %s for: %s stderr:%s",
+ getcwd_buf ? getcwd_buf : "",
+ _running.c_str(),
+ _app.stderr_c_str());
}
-
- char buf[PATH_MAX];
- char *getcwd_buf= getcwd(buf, sizeof(buf));
- throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
- "Unable to open pidfile in %s for: %s stderr:%s",
- getcwd_buf ? getcwd_buf : "",
- _running.c_str(),
- _app.stderr_c_str());
}
}
}
}
// Update pid_file
+ if (has_pid_file())
{
if (_pid_file.empty() and set_pid_file() == false)
{
bool has_pid() const;
+ virtual bool has_pid_file() const
+ {
+ return true;
+ }
+
+ const std::string& error()
+ {
+ return _error;
+ }
+
+ void error(std::string arg)
+ {
+ _error= arg;
+ }
+
virtual bool wait_for_pidfile() const;
bool check_pid(pid_t pid_arg) const
bool set_log_file();
bool set_socket_file();
void reset_pid();
+ std::string _error;
};
std::ostream& operator<<(std::ostream& output, const libtest::Server &arg);
test_return_t regression_bug_71231153_poll(memcached_st *)
{
if (libmemcached_util_ping("10.0.2.252", 0, NULL)) // If for whatever reason someone has a host at this address, skip
+ {
return TEST_SKIPPED;
+ }
{ // Test the poll timeout, on a bad host we should get MEMCACHED_CONNECTION_FAILURE
memcached_st *memc= memcached(test_literal_param("--SERVER=10.0.2.252 --POLL-TIMEOUT=0"));