mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 07:36:10 -04:00
Close executors in BasePcpHandler::Shutdown
The client can call DisconnectFromEndpointManager() explicitly before BasePcpHandler is shut down. In this case, th executors were not terminated inside BasePcpHandler::Shutdown() This caused use-after-free errors in BasePcpHandlerTest.IoError_RequestConnectionFails PiperOrigin-RevId: 551340708
This commit is contained in:
committed by
Copybara-Service
parent
a42cdc7346
commit
cae06bd15d
@@ -84,7 +84,7 @@ BasePcpHandler::~BasePcpHandler() {
|
||||
}
|
||||
|
||||
void BasePcpHandler::Shutdown() {
|
||||
if (stop_) return;
|
||||
if (closed_.Set(true)) return;
|
||||
NEARBY_LOGS(INFO) << "Initiating shutdown of BasePcpHandler("
|
||||
<< strategy_.GetName() << ")";
|
||||
DisconnectFromEndpointManager();
|
||||
|
||||
@@ -609,6 +609,7 @@ class BasePcpHandler : public PcpHandler,
|
||||
Strategy strategy_{PcpToStrategy(pcp_)};
|
||||
EncryptionRunner encryption_runner_;
|
||||
BwuManager* bwu_manager_;
|
||||
AtomicBoolean closed_{false};
|
||||
};
|
||||
|
||||
} // namespace connections
|
||||
|
||||
Reference in New Issue
Block a user