Roll forward to cl/328359974

Change-Id: If2b57ecc852aecf7dea454648f485fd7c08e72a9
This commit is contained in:
Alexey Polyudov
2020-08-25 11:27:27 -07:00
parent 6f9228fa6b
commit c673bf6ac0
110 changed files with 4758 additions and 1245 deletions
+12 -12
View File
@@ -52,13 +52,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();
}
@@ -76,7 +76,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_);
@@ -109,7 +109,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)
@@ -131,7 +131,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)
@@ -156,7 +156,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();
@@ -170,7 +170,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());
}
@@ -185,7 +185,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());
}
@@ -342,22 +342,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();
});