HAL cert and facade: Unregister HCI on shutdown
Test: cert/run_cert.sh
Change-Id: I730b26ec7a15f4ec539c42e16a774c442be93ac9
diff --git a/gd/hal/cert/cert.cc b/gd/hal/cert/cert.cc
index d637f13..a50b1f7 100644
--- a/gd/hal/cert/cert.cc
+++ b/gd/hal/cert/cert.cc
@@ -38,6 +38,10 @@
hal->registerIncomingPacketCallback(this);
}
+ ~HciHalCertService() {
+ hal_->unregisterIncomingPacketCallback();
+ }
+
::grpc::Status SendHciResetCommand(::grpc::ServerContext* context, const ::google::protobuf::Empty* request,
::google::protobuf::Empty* response) override {
std::unique_lock<std::mutex> lock(mutex_);
diff --git a/gd/hal/facade.cc b/gd/hal/facade.cc
index 1072d59..7e486ac 100644
--- a/gd/hal/facade.cc
+++ b/gd/hal/facade.cc
@@ -45,6 +45,10 @@
hal->registerIncomingPacketCallback(this);
}
+ ~HciHalFacadeService() {
+ hal_->unregisterIncomingPacketCallback();
+ }
+
::grpc::Status SendHciResetCommand(::grpc::ServerContext* context, const ::google::protobuf::Empty* request,
::google::protobuf::Empty* response) override {
std::unique_lock<std::mutex> lock(mutex_);