Remove leaked callback when CleanUp() from TimeoutCallback().

When CleanUp() is called indirectly from TimeoutCallback(), the
TimeoutCallback() itself is canceled before the new recurrent call is
scheduled. The CancelTask() call will trivially succeed because the
callback already triggered.

Before CL:281197, the g_source_destroy() call to remove the currently
running callback would prevent it from being re-scheduled even if it
returns TRUE from the callback.

This patch re-schedules the callback before calling CurlPerformOnce()
so CancelTask() would cancel the scheduled task.

Bug: chromium:535649
Test: Added unittest. Verified it fails without the change.

Change-Id: Ica742dab0eb8d9d5c5055c8afac9d775ad1e0012
3 files changed
tree: a3eea6fbc180b8be121efd0eea590335d0248818
  1. dbus_bindings/
  2. include/
  3. init/
  4. payload_generator/
  5. sample_images/
  6. update_manager/
  7. .gitignore
  8. action.h
  9. action_pipe.h
  10. action_pipe_unittest.cc
  11. action_processor.cc
  12. action_processor.h
  13. action_processor_unittest.cc
  14. action_unittest.cc
  15. Android.mk
  16. boot_control.h
  17. boot_control_android.cc
  18. boot_control_android.h
  19. boot_control_chromeos.cc
  20. boot_control_chromeos.h
  21. boot_control_chromeos_unittest.cc
  22. boot_control_interface.h
  23. bzip.cc
  24. bzip.h
  25. bzip_extent_writer.cc
  26. bzip_extent_writer.h
  27. bzip_extent_writer_unittest.cc
  28. certificate_checker.cc
  29. certificate_checker.h
  30. certificate_checker_unittest.cc
  31. chrome_browser_proxy_resolver.cc
  32. chrome_browser_proxy_resolver.h
  33. chrome_browser_proxy_resolver_unittest.cc
  34. clock.cc
  35. clock.h
  36. clock_interface.h
  37. connection_manager.cc
  38. connection_manager.h
  39. connection_manager_interface.h
  40. connection_manager_unittest.cc
  41. constants.cc
  42. constants.h
  43. daemon.cc
  44. daemon.h
  45. dbus_service.cc
  46. dbus_service.h
  47. dbus_service_unittest.cc
  48. dbus_test_utils.h
  49. delta_performer.cc
  50. delta_performer.h
  51. delta_performer_unittest.cc
  52. download_action.cc
  53. download_action.h
  54. download_action_unittest.cc
  55. error_code.h
  56. extent_writer.cc
  57. extent_writer.h
  58. extent_writer_unittest.cc
  59. fake_boot_control.h
  60. fake_clock.h
  61. fake_file_writer.h
  62. fake_hardware.h
  63. fake_p2p_manager.h
  64. fake_p2p_manager_configuration.h
  65. fake_prefs.cc
  66. fake_prefs.h
  67. fake_shill_proxy.cc
  68. fake_shill_proxy.h
  69. fake_system_state.cc
  70. fake_system_state.h
  71. file_descriptor.cc
  72. file_descriptor.h
  73. file_writer.cc
  74. file_writer.h
  75. file_writer_unittest.cc
  76. filesystem_verifier_action.cc
  77. filesystem_verifier_action.h
  78. filesystem_verifier_action_unittest.cc
  79. generate_pc_file.sh
  80. hardware.h
  81. hardware_android.cc
  82. hardware_android.h
  83. hardware_chromeos.cc
  84. hardware_chromeos.h
  85. hardware_interface.h
  86. http_common.cc
  87. http_common.h
  88. http_fetcher.cc
  89. http_fetcher.h
  90. http_fetcher_unittest.cc
  91. hwid_override.cc
  92. hwid_override.h
  93. hwid_override_unittest.cc
  94. install_plan.cc
  95. install_plan.h
  96. libcros_proxy.cc
  97. libcros_proxy.h
  98. libcurl_http_fetcher.cc
  99. libcurl_http_fetcher.h
  100. libupdate_engine-client-test.pc.in
  101. libupdate_engine-client.pc.in
  102. local_coverage_rate
  103. main.cc
  104. metrics.cc
  105. metrics.h
  106. mock_action.h
  107. mock_action_processor.h
  108. mock_certificate_checker.h
  109. mock_connection_manager.h
  110. mock_file_writer.h
  111. mock_hardware.h
  112. mock_http_fetcher.cc
  113. mock_http_fetcher.h
  114. mock_omaha_request_params.h
  115. mock_p2p_manager.h
  116. mock_payload_state.h
  117. mock_prefs.h
  118. mock_update_attempter.h
  119. MODULE_LICENSE_APACHE2
  120. mtd_file_descriptor.cc
  121. mtd_file_descriptor.h
  122. multi_range_http_fetcher.cc
  123. multi_range_http_fetcher.h
  124. NOTICE
  125. omaha_hash_calculator.cc
  126. omaha_hash_calculator.h
  127. omaha_hash_calculator_unittest.cc
  128. omaha_request_action.cc
  129. omaha_request_action.h
  130. omaha_request_action_unittest.cc
  131. omaha_request_params.cc
  132. omaha_request_params.h
  133. omaha_request_params_unittest.cc
  134. omaha_response.h
  135. omaha_response_handler_action.cc
  136. omaha_response_handler_action.h
  137. omaha_response_handler_action_unittest.cc
  138. OWNERS
  139. p2p_manager.cc
  140. p2p_manager.h
  141. p2p_manager_unittest.cc
  142. payload_constants.cc
  143. payload_constants.h
  144. payload_state.cc
  145. payload_state.h
  146. payload_state_interface.h
  147. payload_state_unittest.cc
  148. payload_verifier.cc
  149. payload_verifier.h
  150. platform_constants.h
  151. platform_constants_android.cc
  152. platform_constants_chromeos.cc
  153. postinstall_runner_action.cc
  154. postinstall_runner_action.h
  155. postinstall_runner_action_unittest.cc
  156. prefs.cc
  157. prefs.h
  158. prefs_interface.h
  159. prefs_unittest.cc
  160. PRESUBMIT.cfg
  161. proxy_resolver.cc
  162. proxy_resolver.h
  163. real_system_state.cc
  164. real_system_state.h
  165. run_unittests
  166. sample_omaha_v3_response.xml
  167. shill_proxy.cc
  168. shill_proxy.h
  169. shill_proxy_interface.h
  170. subprocess.cc
  171. subprocess.h
  172. subprocess_unittest.cc
  173. system_state.h
  174. tar_bunzip2.gypi
  175. terminator.cc
  176. terminator.h
  177. terminator_unittest.cc
  178. test_http_server.cc
  179. test_utils.cc
  180. test_utils.h
  181. test_utils_unittest.cc
  182. testrunner.cc
  183. unittest_key.pem
  184. unittest_key2.pem
  185. update_attempter.cc
  186. update_attempter.h
  187. update_attempter_unittest.cc
  188. update_engine-client.gyp
  189. update_engine.conf
  190. update_engine.gyp
  191. update_engine.rc
  192. update_engine_client.cc
  193. update_metadata.proto
  194. UpdateEngine.conf
  195. utils.cc
  196. utils.h
  197. utils_unittest.cc
  198. WATCHLISTS
  199. zip_unittest.cc