projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
remove ambigous Cluster ctor
[awesomized/libmemcached]
/
test
/
lib
/
Cluster.cpp
diff --git
a/test/lib/Cluster.cpp
b/test/lib/Cluster.cpp
index e1375bfde90ed50c65fcb52a3f0cff54c3be35fa..3ecc6e9abea2d629009e3a54cf05e610bdef2e7c 100644
(file)
--- a/
test/lib/Cluster.cpp
+++ b/
test/lib/Cluster.cpp
@@
-7,13
+7,12
@@
Cluster::Cluster(Server serv, uint16_t cnt)
: count{cnt}
, proto{move(serv)}
{
: count{cnt}
, proto{move(serv)}
{
- if (count < 4) {
- count = stoi(getenv_else("MEMCACHED_CLUSTER", "4"));
- }
if (!count) {
count = 1;
}
if (!count) {
count = 1;
}
- reset();
+ for (int i = 0; i < count; ++i) {
+ cluster.push_back(proto);
+ }
}
Cluster::~Cluster() {
}
Cluster::~Cluster() {
@@
-25,14
+24,6
@@
const vector<Server> &Cluster::getServers() const {
return cluster;
}
return cluster;
}
-void Cluster::reset() {
- pids.clear();
- cluster.clear();
- for (int i = 0; i < count; ++i) {
- cluster.push_back(proto);
- }
-}
-
bool Cluster::start() {
bool started = true;
bool Cluster::start() {
bool started = true;
@@
-45,11
+36,15
@@
bool Cluster::start() {
return started;
}
return started;
}
-void Cluster::stop() {
+void Cluster::stop(
bool graceful
) {
for (auto &server : cluster) {
server.drain();
for (auto &server : cluster) {
server.drain();
- // no cookies for memcached; TERM is just too slow
- server.signal(SIGKILL);
+ if (graceful) {
+ server.stop();
+ } else {
+ // no cookies for memcached; TERM is just too slow
+ server.signal(SIGKILL);
+ }
}
}
}
}
@@
-111,3
+106,9
@@
void Cluster::wait() {
}
}
}
}
}
}
+
+bool Cluster::restart() {
+ stop();
+ wait();
+ return start();
+}