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

Commit 94fb36bf authored by Josh Gao's avatar Josh Gao
Browse files

adbd: avoid starting multiple worker threads.

A previous patch intended to make receiving multiple FUNCTIONFS_ENABLEs
non-fatal, but failed to do so because we would try to spawn another
worker thread and hit a different assertion.

Bug: http://b/130638368
Test: echo mem | adb shell "su 0 sh -c 'cat > /sys/power/state'"
Change-Id: I53456112244d8b4f7d26df6ec6961389fca70498
(cherry picked from commit 910ce0ff)
parent 51eb0bb4
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -308,11 +308,13 @@ struct UsbFfsConnection : public Connection {
                        if (bound) {
                        if (bound) {
                            LOG(WARNING) << "received FUNCTIONFS_BIND while already bound?";
                            LOG(WARNING) << "received FUNCTIONFS_BIND while already bound?";
                            running = false;
                            running = false;
                            break;
                        }
                        }


                        if (enabled) {
                        if (enabled) {
                            LOG(WARNING) << "received FUNCTIONFS_BIND while already enabled?";
                            LOG(WARNING) << "received FUNCTIONFS_BIND while already enabled?";
                            running = false;
                            running = false;
                            break;
                        }
                        }


                        bound = true;
                        bound = true;
@@ -322,11 +324,13 @@ struct UsbFfsConnection : public Connection {
                        if (!bound) {
                        if (!bound) {
                            LOG(WARNING) << "received FUNCTIONFS_ENABLE while not bound?";
                            LOG(WARNING) << "received FUNCTIONFS_ENABLE while not bound?";
                            running = false;
                            running = false;
                            break;
                        }
                        }


                        if (enabled) {
                        if (enabled) {
                            LOG(WARNING) << "received FUNCTIONFS_ENABLE while already enabled?";
                            LOG(WARNING) << "received FUNCTIONFS_ENABLE while already enabled?";
                            running = false;
                            running = false;
                            break;
                        }
                        }


                        enabled = true;
                        enabled = true;