Roll forward to cl/328359974

Change-Id: Id081e9ee4e78fc51e01992c1f2db3b9e32b3e776
This commit is contained in:
Alexey Polyudov
2020-08-25 11:37:16 -07:00
parent ae277748ce
commit abc1cbf267
114 changed files with 5241 additions and 1245 deletions
+12 -12
View File
@@ -66,13 +66,13 @@ bool HandleEncryptionSuccess(const std::string& endpoint_id,
return true;
}
void CancelableAlarmRunnable(ClientProxy* client_proxy,
void CancelableAlarmRunnable(ClientProxy* client,
const std::string& endpoint_id,
EndpointChannel* endpoint_channel) {
NEARBY_LOG(INFO,
"Timing out encryption for client %" PRId64
" to endpoint %s after %" PRId64 " ms",
client_proxy->GetClientId(), endpoint_id.c_str(),
client->GetClientId(), endpoint_id.c_str(),
static_cast<std::int64_t>(absl::ToInt64Milliseconds(kTimeout)));
endpoint_channel->Close();
}
@@ -90,7 +90,7 @@ class ServerRunnable final {
void operator()() const {
CancelableAlarm timeout_alarm(
"EncryptionRunner.startServer() timeout",
"EncryptionRunner.StartServer() timeout",
[this]() { CancelableAlarmRunnable(client_, endpoint_id_, channel_); },
kTimeout, alarm_executor_);
@@ -123,7 +123,7 @@ class ServerRunnable final {
return;
}
NEARBY_LOG(INFO, "In startServer(), read UKEY2 Message 1 from endpoint %s",
NEARBY_LOG(INFO, "In StartServer(), read UKEY2 Message 1 from endpoint %s",
endpoint_id_.c_str());
// Message 2 (Server Init)
@@ -145,7 +145,7 @@ class ServerRunnable final {
return;
}
NEARBY_LOG(INFO, "In startServer(), wrote UKEY2 Message 2 to endpoint %s",
NEARBY_LOG(INFO, "In StartServer(), wrote UKEY2 Message 2 to endpoint %s",
endpoint_id_.c_str());
// Message 3 (Client Finish)
@@ -170,7 +170,7 @@ class ServerRunnable final {
return;
}
NEARBY_LOG(INFO, "In startServer(), read UKEY2 Message 3 from endpoint %s",
NEARBY_LOG(INFO, "In StartServer(), read UKEY2 Message 3 from endpoint %s",
endpoint_id_.c_str());
timeout_alarm.Cancel();
@@ -184,7 +184,7 @@ class ServerRunnable final {
private:
void LogException() const {
NEARBY_LOG(ERROR, "In startServer(), UKEY2 failed with endpoint %s",
NEARBY_LOG(ERROR, "In StartServer(), UKEY2 failed with endpoint %s",
endpoint_id_.c_str());
}
@@ -199,7 +199,7 @@ class ServerRunnable final {
channel_->Write(ByteArray(*parse_result.alert_to_send));
if (!write_exception.Ok()) {
NEARBY_LOG(WARNING,
"In startServer(), client %" PRId64
"In StartServer(), client %" PRId64
" failed to pass the alert error message to endpoint %s",
client_->GetClientId(), endpoint_id_.c_str());
}
@@ -356,22 +356,22 @@ EncryptionRunner::~EncryptionRunner() {
}
void EncryptionRunner::StartServer(
ClientProxy* client_proxy, const std::string& endpoint_id,
ClientProxy* client, const std::string& endpoint_id,
EndpointChannel* endpoint_channel,
EncryptionRunner::ResultListener&& listener) {
server_executor_.Execute(
[runnable{ServerRunnable(client_proxy, &alarm_executor_, endpoint_id,
[runnable{ServerRunnable(client, &alarm_executor_, endpoint_id,
endpoint_channel, std::move(listener))}]() {
runnable();
});
}
void EncryptionRunner::StartClient(
ClientProxy* client_proxy, const std::string& endpoint_id,
ClientProxy* client, const std::string& endpoint_id,
EndpointChannel* endpoint_channel,
EncryptionRunner::ResultListener&& listener) {
client_executor_.Execute(
[runnable{ClientRunnable(client_proxy, &alarm_executor_, endpoint_id,
[runnable{ClientRunnable(client, &alarm_executor_, endpoint_id,
endpoint_channel, std::move(listener))}]() {
runnable();
});