X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=testing%2Flib%2FCluster.cpp;h=c3c625cf04eb225069a08d4b5f732ea68132eade;hb=d347d509b7c0150a75ba77307a61411a2a114599;hp=4c6ea52c258f49c256d4987d8ce5336666bc64c3;hpb=d1c9b695e9b3fbfcc94230a242b0290b43f27006;p=m6w6%2Flibmemcached diff --git a/testing/lib/Cluster.cpp b/testing/lib/Cluster.cpp index 4c6ea52c..c3c625cf 100644 --- a/testing/lib/Cluster.cpp +++ b/testing/lib/Cluster.cpp @@ -44,6 +44,7 @@ bool Cluster::start() { void Cluster::stop() { for (auto &server : cluster) { + server.drain(); // no cookies for memcached; TERM is just too slow server.signal(SIGKILL); } @@ -65,7 +66,7 @@ bool Cluster::isListening() { // zombie? auto old_pid = server.getPid(); if (server.tryWait()) { - cerr << "zombie collected (old pid=" << old_pid << "): " << server << "\n"; + cerr << "Collected zombie " << server << "(old pid=" << old_pid << ")\n"; pids.erase(old_pid); // restart startServer(server); @@ -85,9 +86,8 @@ bool Cluster::isListening() { } bool Cluster::startServer(Server &server) { - auto pid = server.start(); - if (pid.has_value()) { - pids[*pid] = &server; + if (server.start().has_value()) { + pids[server.getPid()] = &server; return true; } return false;