Changes have been pushed for the repository "fawkesrobotics/fawkes".
Clone: https://github.com/fawkesrobotics/fawkes.git Gitweb: https://github.com/fawkesrobotics/fawkes The branch, thofmann/mongocxx-v3 has been updated to 3282cc2005f890a99a32af752f260cb9c970c9ec (commit) from dcb75fcc4048c97b87353bef2c85adaeb209ecbf (commit) https://github.com/fawkesrobotics/fawkes/tree/thofmann/mongocxx-v3 Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - *Log* --------------------------------------------------------------- commit 3282cc2005f890a99a32af752f260cb9c970c9ec Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> AuthorDate: Thu Apr 18 17:52:30 2019 +0200 Commit: Till Hofmann <hofm...@kbsg.rwth-aachen.de> CommitDate: Thu Apr 18 17:52:30 2019 +0200 mongodb: simplify mongocxx client init in MongoDBInstanceConfig No need to create the client on the heap, create it on the stack instead. Also simplify the URI construction. https://github.com/fawkesrobotics/fawkes/commit/3282cc200 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *Summary* ----------------------------------------------------------- src/plugins/mongodb/mongodb_instance_config.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) - *Diffs* ------------------------------------------------------------- - *commit* 3282cc2005f890a99a32af752f260cb9c970c9ec - - - - - - - - - - Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> Date: Thu Apr 18 17:52:30 2019 +0200 Subject: mongodb: simplify mongocxx client init in MongoDBInstanceConfig src/plugins/mongodb/mongodb_instance_config.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) _Diff for modified files_: diff --git a/src/plugins/mongodb/mongodb_instance_config.cpp b/src/plugins/mongodb/mongodb_instance_config.cpp index da4384096..16bc27ad4 100644 --- a/src/plugins/mongodb/mongodb_instance_config.cpp +++ b/src/plugins/mongodb/mongodb_instance_config.cpp @@ -242,19 +242,14 @@ bool MongoDBInstanceConfig::check_alive() { try { - std::ostringstream hostport; - hostport << "mongodb://" - << "localhost" - << ":" << port_; - mongocxx::uri uri{hostport.str()}; - std::shared_ptr<mongocxx::client> client = std::make_shared<mongocxx::client>(uri); - std::string errmsg; + mongocxx::client client{mongocxx::uri{"mongodb://localhost:" + port_}}; + std::string errmsg; using namespace bsoncxx::builder; auto cmd{basic::document{}}; cmd.append(basic::kvp("isMaster", 1)); - auto reply = client->database("admin").run_command(cmd.view()); + auto reply = client["admin"].run_command(cmd.view()); bool ok = int(reply.view()["ok"].get_double()) == 1; if (!ok) { logger->log_warn(name(), "Failed to connect: %s", bsoncxx::to_json(reply.view()).c_str()); _______________________________________________ fawkes-commits mailing list fawkes-commits@lists.kbsg.rwth-aachen.de https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits