Isolate background plugin initialization

Summary:
Background plugins are initialised when flipper connects.
But there's no isolation, so if any fail to initialize, then we don't carry on initializing the rest.
This fixes that by skipping failed ones only.

Reviewed By: passy

Differential Revision: D17600854

fbshipit-source-id: 2ef04cbcecda78ca448c2f4d56639ba63792e2f7
This commit is contained in:
John Knox
2019-09-26 07:00:10 -07:00
committed by Facebook Github Bot
parent c907e53189
commit f72e6e0f5e

View File

@@ -102,9 +102,15 @@ void FlipperClient::startBackgroundPlugins() {
++it) { ++it) {
std::cout << it->first << std::endl; std::cout << it->first << std::endl;
if (it->second.get()->runInBackground()) { if (it->second.get()->runInBackground()) {
auto& conn = connections_[it->first]; try {
conn = std::make_shared<FlipperConnectionImpl>(socket_.get(), it->first); auto& conn = connections_[it->first];
it->second.get()->didConnect(conn); conn =
std::make_shared<FlipperConnectionImpl>(socket_.get(), it->first);
it->second.get()->didConnect(conn);
} catch (std::exception& e) {
log("Exception starting background plugin: " + it->first + ". " +
e.what());
}
} }
} }
} }