diff --git a/connections/implementation/endpoint_channel_manager.h b/connections/implementation/endpoint_channel_manager.h index 2f7348aa..df38a538 100644 --- a/connections/implementation/endpoint_channel_manager.h +++ b/connections/implementation/endpoint_channel_manager.h @@ -28,6 +28,7 @@ #include "internal/platform/feature_flags.h" #include "internal/platform/mutex.h" #include "internal/proto/analytics/connections_log.pb.h" +#include "proto/connections_enums.pb.h" namespace nearby { namespace connections { diff --git a/connections/implementation/endpoint_manager.cc b/connections/implementation/endpoint_manager.cc index 0e61b8c1..97c393dd 100644 --- a/connections/implementation/endpoint_manager.cc +++ b/connections/implementation/endpoint_manager.cc @@ -47,6 +47,8 @@ using ::location::nearby::analytics::proto::ConnectionsLog; using ::location::nearby::connections::OfflineFrame; using ::location::nearby::connections::V1Frame; using ::nearby::analytics::PacketMetaData; +using DisconnectionReason = + ::location::nearby::proto::connections::DisconnectionReason; // We set this to 11s to provide sufficient time for an in-progress WebRTC // bandwidth upgrade to resolve. This is chosen to be slightly longer than the @@ -204,7 +206,7 @@ ExceptionOr EndpointManager::TryDecryptFrame( } auto elapsed = SystemClock::ElapsedRealtime() - start_time; if (elapsed > kDecryptRetryTimeout) { - NEARBY_LOGS(WARNING) << "Can't decrypt the mesage. Timeout after " + NEARBY_LOGS(WARNING) << "Can't decrypt the message. Timeout after " << elapsed; return Exception::kTimeout; } @@ -781,6 +783,7 @@ bool EndpointManager::ApplySafeToDisconnect(const std::string& endpoint_id, DisconnectionReason reason) { NEARBY_LOGS(INFO) << "[safe-to-disconnect] ApplySafeToDisconnect reason: " << reason; + // TODO(b/303544913): clean up the safe-to-disconnect logic bool is_safe_disconnection = false; bool send_disconnection_frame = true; absl::Duration timeout_millis = FeatureFlags::GetInstance() @@ -790,6 +793,7 @@ bool EndpointManager::ApplySafeToDisconnect(const std::string& endpoint_id, switch (reason) { case DisconnectionReason::UPGRADED: case DisconnectionReason::SHUTDOWN: + case DisconnectionReason::PREV_CHANNEL_DISCONNECTION_IN_RECONNECT: case DisconnectionReason::UNFINISHED: return true; // safe disconnection case DisconnectionReason::IO_ERROR: