| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // NOTE: lifted from src/platform/update_engine and tweaked for cashew | 5 // NOTE: lifted from src/platform/update_engine and tweaked for cashew |
| 6 // TODO(vlaviano): see http_fetcher.h | 6 // TODO(vlaviano): see http_fetcher.h |
| 7 | 7 |
| 8 #ifndef SRC_LIBCURL_HTTP_FETCHER_H_ | 8 #ifndef SRC_LIBCURL_HTTP_FETCHER_H_ |
| 9 #define SRC_LIBCURL_HTTP_FETCHER_H_ | 9 #define SRC_LIBCURL_HTTP_FETCHER_H_ |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Cleans up the following if they are non-null: | 119 // Cleans up the following if they are non-null: |
| 120 // curl(m) handles, io_channels_, timeout_source_. | 120 // curl(m) handles, io_channels_, timeout_source_. |
| 121 void CleanUp(); | 121 void CleanUp(); |
| 122 | 122 |
| 123 // Handles for the libcurl library | 123 // Handles for the libcurl library |
| 124 CURLM *curl_multi_handle_; | 124 CURLM *curl_multi_handle_; |
| 125 CURL *curl_handle_; | 125 CURL *curl_handle_; |
| 126 | 126 |
| 127 // a list of all file descriptors that we're waiting on from the | 127 // Lists of all read(0)/write(1) file descriptors that we're waiting on from |
| 128 // glib main loop | 128 // the glib main loop. libcurl may open/close descriptors and switch their |
| 129 // directions so maintain two separate lists so that watch conditions can be |
| 130 // set appropriately. |
| 129 typedef std::map<int, std::pair<GIOChannel*, guint> > IOChannels; | 131 typedef std::map<int, std::pair<GIOChannel*, guint> > IOChannels; |
| 130 IOChannels io_channels_; | 132 IOChannels io_channels_[2]; |
| 131 | 133 |
| 132 // if non-NULL, a timer we're waiting on. glib main loop will call us back | 134 // if non-NULL, a timer we're waiting on. glib main loop will call us back |
| 133 // when it fires. | 135 // when it fires. |
| 134 GSource* timeout_source_; | 136 GSource* timeout_source_; |
| 135 | 137 |
| 136 bool transfer_in_progress_; | 138 bool transfer_in_progress_; |
| 137 | 139 |
| 138 // The transfer size. -1 if not known. | 140 // The transfer size. -1 if not known. |
| 139 off_t transfer_size_; | 141 off_t transfer_size_; |
| 140 | 142 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 153 | 155 |
| 154 // Seconds to wait before asking libcurl to "perform". | 156 // Seconds to wait before asking libcurl to "perform". |
| 155 int idle_seconds_; | 157 int idle_seconds_; |
| 156 | 158 |
| 157 DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher); | 159 DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher); |
| 158 }; | 160 }; |
| 159 | 161 |
| 160 } // namespace cashew | 162 } // namespace cashew |
| 161 | 163 |
| 162 #endif // SRC_LIBCURL_HTTP_FETCHER_H_ | 164 #endif // SRC_LIBCURL_HTTP_FETCHER_H_ |
| OLD | NEW |