Revert D8954014: [sonar] Start adding state annotations for diagnostic screen
Differential Revision: D8954014 Original commit changeset: 864156b0d3f5 fbshipit-source-id: 6dc0aaf56f609ade6123e450978df08f4b7331fc
This commit is contained in:
committed by
Facebook Github Bot
parent
fadd392349
commit
e82fd6371d
@@ -47,16 +47,14 @@ void SonarClient::setStateListener(
|
||||
|
||||
void SonarClient::addPlugin(std::shared_ptr<SonarPlugin> plugin) {
|
||||
SONAR_LOG(("SonarClient::addPlugin " + plugin->identifier()).c_str());
|
||||
auto step = sonarState_->start("Add plugin " + plugin->identifier());
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
performAndReportError([this, plugin, step]() {
|
||||
performAndReportError([this, plugin]() {
|
||||
if (plugins_.find(plugin->identifier()) != plugins_.end()) {
|
||||
throw std::out_of_range(
|
||||
"plugin " + plugin->identifier() + " already added.");
|
||||
}
|
||||
plugins_[plugin->identifier()] = plugin;
|
||||
step->complete();
|
||||
if (connected_) {
|
||||
refreshPlugins();
|
||||
}
|
||||
@@ -109,22 +107,19 @@ void SonarClient::refreshPlugins() {
|
||||
void SonarClient::onConnected() {
|
||||
SONAR_LOG("SonarClient::onConnected");
|
||||
|
||||
auto step = sonarState_->start("Connect");
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
connected_ = true;
|
||||
step->complete();
|
||||
}
|
||||
|
||||
void SonarClient::onDisconnected() {
|
||||
SONAR_LOG("SonarClient::onDisconnected");
|
||||
auto step = sonarState_->start("onDisconnected callbacks");
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
connected_ = false;
|
||||
performAndReportError([this, step]() {
|
||||
performAndReportError([this]() {
|
||||
for (const auto& iter : plugins_) {
|
||||
disconnect(iter.second);
|
||||
}
|
||||
step->complete();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -42,21 +42,15 @@ class SonarClient : public SonarWebSocket::Callbacks {
|
||||
SonarClient(std::unique_ptr<SonarWebSocket> socket)
|
||||
: socket_(std::move(socket)) {
|
||||
sonarState_ = std::make_unique<SonarState>();
|
||||
auto step = sonarState_->start("Create client");
|
||||
socket_->setCallbacks(this);
|
||||
step->complete();
|
||||
}
|
||||
|
||||
void start() {
|
||||
auto step = sonarState_->start("Start client");
|
||||
socket_->start();
|
||||
step->complete();
|
||||
}
|
||||
|
||||
void stop() {
|
||||
auto step = sonarState_->start("Stop client");
|
||||
socket_->stop();
|
||||
step->complete();
|
||||
}
|
||||
|
||||
void onConnected() override;
|
||||
|
||||
Reference in New Issue
Block a user