analytics: 3p NC: Implement EstablishedConnections.

PiperOrigin-RevId: 394582833
This commit is contained in:
edwinwu
2021-09-02 18:01:11 -07:00
committed by Copybara-Service
parent ada8d857cb
commit a21b4b55d7
11 changed files with 184 additions and 33 deletions
@@ -256,11 +256,22 @@ void BaseEndpointChannel::CloseIo() {
}
}
void BaseEndpointChannel::SetAnalyticsRecorder(
analytics::AnalyticsRecorder* analytics_recorder,
const std::string& endpoint_id) {
analytics_recorder_ = analytics_recorder;
endpoint_id_ = endpoint_id;
}
void BaseEndpointChannel::Close(
proto::connections::DisconnectionReason reason) {
NEARBY_LOGS(INFO) << __func__
<< ": Closing endpoint channel, reason: " << reason;
Close();
if (analytics_recorder_ != nullptr && !endpoint_id_.empty()) {
analytics_recorder_->OnConnectionClosed(endpoint_id_, GetMedium(), reason);
}
}
std::string BaseEndpointChannel::GetType() const {