Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7f0a042 authored by Akilesh Kailash's avatar Akilesh Kailash
Browse files

snapuserd: Terminate daemon spin up during first stage init



Bug: 214340811
Test: OTA
Signed-off-by: default avatarAkilesh Kailash <akailash@google.com>
Change-Id: I481548e878ff7ee5fdf7343fab961a1ded391634
parent d5f32019
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ bool Daemon::StartServerForUserspaceSnapshots(int arg_start, int argc, char** ar

    MaskAllSignalsExceptIntAndTerm();

    user_server_.SetServerRunning();

    if (FLAGS_socket_handoff) {
        return user_server_.RunForSocketHandoff();
    }
@@ -170,7 +172,10 @@ void Daemon::MaskAllSignals() {
}

void Daemon::Interrupt() {
    if (IsUserspaceSnapshotsEnabled()) {
    // TODO: We cannot access system property during first stage init.
    // Until we remove the dm-snapshot code, we will have this check
    // and verify it through a temp variable.
    if (user_server_.IsServerRunning()) {
        user_server_.Interrupt();
    } else {
        server_.Interrupt();
@@ -178,7 +183,7 @@ void Daemon::Interrupt() {
}

void Daemon::ReceivedSocketSignal() {
    if (IsUserspaceSnapshotsEnabled()) {
    if (user_server_.IsServerRunning()) {
        user_server_.ReceivedSocketSignal();
    } else {
        server_.ReceivedSocketSignal();
+3 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ class UserSnapshotServer {
    std::vector<struct pollfd> watched_fds_;
    bool is_socket_present_ = false;
    int num_partitions_merge_complete_ = 0;
    bool is_server_running_ = false;

    std::mutex lock_;

@@ -136,6 +137,8 @@ class UserSnapshotServer {

    void SetTerminating() { terminating_ = true; }
    void ReceivedSocketSignal() { received_socket_signal_ = true; }
    void SetServerRunning() { is_server_running_ = true; }
    bool IsServerRunning() { return is_server_running_; }
};

}  // namespace snapshot