mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Roll forward up to cl/355211070.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "core/internal/offline_frames.h"
|
||||
#include "proto/connections/offline_wire_formats.pb.h"
|
||||
#include "platform/base/feature_flags.h"
|
||||
#include "platform/public/logging.h"
|
||||
#include "platform/public/mutex.h"
|
||||
#include "platform/public/mutex_lock.h"
|
||||
@@ -128,6 +129,12 @@ bool EndpointChannelManager::ChannelState::RemoveEndpoint(
|
||||
item->second.disconnect_reason = reason;
|
||||
auto channel = item->second.channel;
|
||||
if (channel) {
|
||||
// If the channel was paused (i.e. during a bandwidth upgrade negotiation)
|
||||
// we resume to ensure the thread won't hang when trying to write to it.
|
||||
if (FeatureFlags::GetInstance().GetFlags().resume_before_disconnect) {
|
||||
channel->Resume();
|
||||
}
|
||||
|
||||
channel->Write(parser::ForDisconnection());
|
||||
SystemClock::Sleep(kDataTransferDelay);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class FeatureFlags {
|
||||
// Holds for all the feature flags.
|
||||
struct Flags {
|
||||
bool enable_cancellation_flags = false;
|
||||
bool resume_before_disconnect = true;
|
||||
};
|
||||
|
||||
static const FeatureFlags& GetInstance() {
|
||||
|
||||
Reference in New Issue
Block a user