projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
libmemcached-1.0: add memcached_return_t::MEMCACHED_UNIX_SOCKET_PATH_TOO_BIG
[awesomized/libmemcached]
/
libtest
/
server.cc
diff --git
a/libtest/server.cc
b/libtest/server.cc
index 02aeec70203bc195d20507406d855d6773c503cf..d024d054ab02e4e6d1e284c7a601930f49f8238e 100644
(file)
--- a/
libtest/server.cc
+++ b/
libtest/server.cc
@@
-98,7
+98,7
@@
class Buffer
{
public:
Buffer(char *b) : b_(b) {}
{
public:
Buffer(char *b) : b_(b) {}
- ~Buffer() { free(b_); }
+ ~Buffer() {
if (b_)
free(b_); }
char* buf() { return b_; }
private:
char *b_;
char* buf() { return b_; }
private:
char *b_;
@@
-173,6
+173,22
@@
bool Server::wait_for_pidfile() const
return wait.successful();
}
return wait.successful();
}
+bool Server::init(const char *argv[])
+{
+ if (argv)
+ {
+ for (const char **ptr= argv; *ptr ; ++ptr)
+ {
+ if (ptr)
+ {
+ add_option(*ptr);
+ }
+ }
+ }
+
+ return build();
+}
+
bool Server::has_pid() const
{
return (_app.pid() > 1);
bool Server::has_pid() const
{
return (_app.pid() > 1);
@@
-295,7
+311,9
@@
bool Server::start()
if (pinged == false)
{
if (pinged == false)
{
- Error << "ping(" << _app.pid() << ") wait: " << this_wait << " " << hostname() << ":" << port() << " run:" << _running << " " << error();
+#if 0
+ Error << "Failed to ping(" << _app.pid() << ") wait: " << this_wait << " " << hostname() << ":" << port() << " run:" << _running << " " << error();
+#endif
// If we happen to have a pid file, lets try to kill it
if ((pid_file().empty() == false) and (access(pid_file().c_str(), R_OK) == 0))
// If we happen to have a pid file, lets try to kill it
if ((pid_file().empty() == false) and (access(pid_file().c_str(), R_OK) == 0))
@@
-480,13
+498,16
@@
bool Server::args(Application& app)
for (Options::const_iterator iter= _options.begin(); iter != _options.end(); ++iter)
{
for (Options::const_iterator iter= _options.begin(); iter != _options.end(); ++iter)
{
- if ((*iter).second.empty() == false)
- {
- app.add_option((*iter).first, (*iter).second);
- }
- else
+ if ((*iter).first.empty() == false)
{
{
- app.add_option((*iter).first);
+ if ((*iter).second.empty() == false)
+ {
+ app.add_option((*iter).first, (*iter).second);
+ }
+ else
+ {
+ app.add_option((*iter).first);
+ }
}
}
}
}