Call onDisconnect callbacks when disconnected

Summary: I noticed from the diagnostics screen that onDisconnected was never being called when sonar disconnects.

Reviewed By: danielbuechele

Differential Revision: D9265562

fbshipit-source-id: afd070126c6ef02a98c8dbc6589b6f9b8b83a730
This commit is contained in:
John Knox
2018-08-10 09:04:34 -07:00
committed by Facebook Github Bot
parent a9b8c3d2c9
commit 800302b433
2 changed files with 2 additions and 2 deletions

View File

@@ -118,7 +118,7 @@ void SonarClient::onConnected() {
void SonarClient::onDisconnected() {
SONAR_LOG("SonarClient::onDisconnected");
auto step = sonarState_->start("onDisconnected callbacks");
auto step = sonarState_->start("Trigger onDisconnected callbacks");
std::lock_guard<std::mutex> lock(mutex_);
connected_ = false;
performAndReportError([this, step]() {

View File

@@ -64,8 +64,8 @@ class ConnectionEvents : public rsocket::RSocketConnectionEvents {
if (!websocket_->isOpen_)
return;
websocket_->isOpen_ = false;
websocket_->connectionIsTrusted_ = false;
if (websocket_->connectionIsTrusted_) {
websocket_->connectionIsTrusted_ = false;
websocket_->callbacks_->onDisconnected();
}
websocket_->reconnect();