From 3f61031345c6416640f22b304303162fce415071 Mon Sep 17 00:00:00 2001 From: hai007 Date: Thu, 16 Mar 2023 12:14:53 -0700 Subject: [PATCH] 1. Supports payload received ack sync for sender 2. Supports safe-to-disconnect check (no auto reconnect or auto resume transfer yet) PiperOrigin-RevId: 517191691 --- .../implementation/proto/offline_wire_formats.proto | 9 ++++++++- proto/connections_enums.proto | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/connections/implementation/proto/offline_wire_formats.proto b/connections/implementation/proto/offline_wire_formats.proto index e20cea58..5cc9518f 100644 --- a/connections/implementation/proto/offline_wire_formats.proto +++ b/connections/implementation/proto/offline_wire_formats.proto @@ -125,6 +125,7 @@ message ConnectionResponseFrame { // means bt supports multiplex while 0x00 means not. Refer to ClientProxy.java // for the bit usages. optional int32 multiplex_socket_bitmask = 5; + optional int32 nearby_connections_version = 6; } message PayloadTransferFrame { @@ -165,6 +166,7 @@ message PayloadTransferFrame { UNKNOWN_EVENT_TYPE = 0; PAYLOAD_ERROR = 1; PAYLOAD_CANCELED = 2; + PAYLOAD_RECEIVED_ACK = 3; } optional EventType event = 1; @@ -296,7 +298,12 @@ message KeepAliveFrame { // in other situations to trigger a faster disconnection event than waiting for // socket closed on the remote side. message DisconnectionFrame { - // Empty on purpose. + // Apply safe-to-disconnect protocol if true. + optional bool request_safe_to_disconnect = 1; + + // Ack of receiving Disconnection frame will be sent to the sender + // frame. + optional bool ack_safe_to_disconnect = 2; } // A paired key encryption packet sent between devices, contains signed data. diff --git a/proto/connections_enums.proto b/proto/connections_enums.proto index ec8a3cf7..4380ce64 100644 --- a/proto/connections_enums.proto +++ b/proto/connections_enums.proto @@ -205,6 +205,12 @@ enum PayloadStatus { // The connection not encrypted yet. ENDPOINT_UNENCRYPTED = 9; + + // The payload was stopped by the local client disconnection. + LOCAL_CLIENT_DISCONNECTION = 10; + + // The payload was stopped by the remote client disconnection. + REMOTE_CLIENT_DISCONNECTION = 11; } // The bandwidth of the mediums.