libsnapshot: Terminate snapuserd daemon after merge completion

Bug: 214340811
Test: OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Icaed87feb7760074d743229856f23f3599e03c62
This commit is contained in:
Akilesh Kailash 2022-01-13 09:08:08 +00:00
parent 6a79e8113a
commit 0616cb17c2

View file

@ -1467,6 +1467,14 @@ void SnapshotManager::AcknowledgeMergeSuccess(LockedFile* lock) {
}
RemoveAllUpdateState(lock);
if (UpdateUsesUserSnapshots(lock) && !device()->IsTestDevice()) {
if (snapuserd_client_) {
snapuserd_client_->DetachSnapuserd();
snapuserd_client_->CloseConnection();
snapuserd_client_ = nullptr;
}
}
}
void SnapshotManager::AcknowledgeMergeFailure(MergeFailureCode failure_code) {
@ -3200,7 +3208,7 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife
// Terminate stale daemon if any
std::unique_ptr<SnapuserdClient> snapuserd_client =
SnapuserdClient::Connect(kSnapuserdSocket, 10s);
SnapuserdClient::Connect(kSnapuserdSocket, 5s);
if (snapuserd_client) {
snapuserd_client->DetachSnapuserd();
snapuserd_client->CloseConnection();