fix auto-resume logging issue

PiperOrigin-RevId: 571981185
This commit is contained in:
hai007
2023-10-12 04:48:08 +00:00
committed by Anay Wadhera
parent 5d4aab0185
commit 1d7751f581
2 changed files with 6 additions and 1 deletions
@@ -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 {
@@ -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<OfflineFrame> 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: