flush
[awesomized/libmemcached] / testing / lib / Cluster.hpp
index 416da13849067386af93ad13b34c1b67aba5c3a0..1bbc9d22325568a7c64369b068b1e64175377c26 100644 (file)
@@ -6,15 +6,25 @@
 class Cluster {
 public:
   explicit
-  Cluster(Server &&serv, uint16_t cnt = 0);
+  Cluster(Server serv, uint16_t cnt = 0);
 
   ~Cluster();
 
   Cluster(const Cluster &c) = delete;
   Cluster &operator = (const Cluster &c) = delete;
 
-  Cluster(Cluster &&c) = default;
-  Cluster &operator = (Cluster &&c) = default;
+  Cluster(Cluster &&c)
+  : proto{}
+  {
+    *this = move(c);
+  };
+  Cluster &operator = (Cluster &&c) {
+    count = exchange(c.count, 0);
+    proto = exchange(c.proto, Server{});
+    cluster = exchange(c.cluster, {});
+    pids = exchange(c.pids, {});
+    return *this;
+  }
 
   const vector<Server> &getServers() const;
 
@@ -30,4 +40,6 @@ private:
   Server proto;
   vector<Server> cluster;
   map<pid_t, Server *> pids;
+
+  bool startServer(Server &server);
 };