summaryrefslogtreecommitdiff
path: root/common/action_processor.cc
AgeCommit message (Collapse)Author
2019-01-16update_engine: Run clang-format on common/Amin Hassani
BUG=none TEST=unittest Change-Id: Icdaf5017e03a197bc576f08f4b8dcdd00cff217c Reviewed-on: https://chromium-review.googlesource.com/1407541 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
2018-07-25update_engine: Pass Action ownership to ActionProcessorAmin Hassani
Currently, an object that uses an ActionProcessor for processing one or more actions has to own the Actions. This is problematic, because if we want to create an action on the fly and use an ActionProcessor to perform it, we have to own the Action until it is finished. Furthermore, if someone forget to own the action, there will be memory leaks because ActionProcessor does not delete the Action. This patch passes the ownership of the Actions to the ActionProcessor through unique pointers. If an object wants to have access to the Action, it can get it when ActionComplete() is called. BUG=chromium:807976 TEST=unittests TEST=cros flash TEST=precq Change-Id: I28f7e9fd3425f17cc51b4db4a4abc130a7d6ef8f Reviewed-on: https://chromium-review.googlesource.com/1065113 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Xiaochu Liu <xiaochu@chromium.org>
2016-03-04Implement suspend, resume and cancel the download.Alex Deymo
The DownloadAction can now be suspended and resumed, using the existing libcurl hooks to pause the download. For canceling an ongoing update, this patch leverages the existing StopProcessing method previously used in unittest only with a slight change: Stopping the ActionProcessor also removes all the pending actions. The LibcurlHttpFetcher Pause/Unpause methods where improved to support (not crash) if paused in circumstances where there isn't a current connection, like when waiting for the proxy resolver and when trying to reconnect. Finally, the value of ongoing_update_ is now properly set in the UpdateAttempter. Bug: 27047026 TEST=Tested suspending, resuming and canceling the update on a device. TEST=Added unittest for the Pause/Unpause logic. Change-Id: I0df1e1a8cf70a3b736bc9cd4899d37813f381b94
2016-02-29Allow to Suspend/Resume the ActionProcessor.Alex Deymo
This patch implements the core functionality of suspend/resume actions from the ActionProcessor. No actions support suspend/resume yet. Bug: 27047026 TEST=Added unittets, tested on edison-eng. Change-Id: Ib9600098dbccf05fc30f10f0add4a5bc87892b66
2015-12-04Fix crash on shutdown when update in progress.Alex Deymo
The ActionProcessor destructor normally calls the ProcessingStop method on the delegate. For the UpdateAttempter this call re-schedules a new update attempt on a half-destroyed update_attempter instance, crashing update_engine on SIGTERM when the ActionProcessor was running. This patch inhibits the ActionProcessor from notifying the delegate of the processor stopping when destroying the update_attempter instance. It also fixes the declaration order of the dbus_adaptor_ and disables its usage during daemon shutdown. Bug: 24989397 TEST=start update-engine; (update_engine_client --update &); sleep 6; stop update-engine; tail /var/log/update_engine.log TEST=FEATURES=test emerge-link update_engine Change-Id: I0a40067f63e89759ff80c79cecb6f89b10dba0c2
2015-11-12Split payload application code into a subdirectory.Alex Deymo
This patch splits from the main libupdate_engine code the part that is strictly used to download and apply a payload into a new static library, moving the code to subdirectories. The new library is divided in two subdirectories: common/ and payload_consumer/, and should not depend on other update_engine files outside those two subdirectories. The main difference between those two is that the common/ tools are more generic and not tied to the payload consumer process, but otherwise they are both compiled together. There are still dependencies from the new libpayload_consumer library into the main directory files and DBus generated files. Those will be addressed in follow up CLs. Bug: 25197634 Test: FEATURES=test emerge-link update_engine; `mm` on Brillo. Change-Id: Id8d0204ea573627e6e26ca9ea17b9592ca95bc23