X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=test%2Flib%2FCluster.cpp;h=54de9398564e25c5cba32f328fe56299448b7bcd;hb=fd66e60622e8e139753f62454cfdd5be662e39a0;hp=e32f0fc328fd1724e0384553e288090a2d28d676;hpb=2c43b7ea471c819c8e726eefccc39a469f6b9ae6;p=m6w6%2Flibmemcached diff --git a/test/lib/Cluster.cpp b/test/lib/Cluster.cpp index e32f0fc3..54de9398 100644 --- a/test/lib/Cluster.cpp +++ b/test/lib/Cluster.cpp @@ -46,11 +46,15 @@ bool Cluster::start() { return started; } -void Cluster::stop() { +void Cluster::stop(bool graceful) { 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); + } } } @@ -112,3 +116,9 @@ void Cluster::wait() { } } } + +bool Cluster::restart() { + stop(); + wait(); + return start(); +}