bin: consolidate clients
[awesomized/libmemcached] / src / bin / common / options.cpp
index 4583e7b73e9a2537b5daf2e1ed906b0cc0561b9d..229f4f0f943a1b55997e7dce174cc9092d7c6071 100644 (file)
@@ -153,12 +153,23 @@ bool client_options::apply(memcached_st *memc) {
   }
 #endif // _WIN32
 
+  extended_option *servers = nullptr;
   for (auto &opt : options) {
     if (opt.apply) {
+      // servers should be applied last, so they take up any behaviors previously set
+      if (opt.opt.val == 's' && opt.opt.name == std::string("servers")) {
+        servers = &opt;
+        continue;
+      }
       if (!opt.apply(*this, opt, memc)) {
         return false;
       }
     }
   }
+  if (servers) {
+    if (!servers->apply(*this, *servers, memc)) {
+      return false;
+    }
+  }
   return true;
 }