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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <curl/curl.h> | 10 #include <curl/curl.h> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // expensive. | 140 // expensive. |
141 bool ConnectionIsExpensive() const; | 141 bool ConnectionIsExpensive() const; |
142 | 142 |
143 // Returns whether or not the current build is official. | 143 // Returns whether or not the current build is official. |
144 bool IsOfficialBuild() const; | 144 bool IsOfficialBuild() const; |
145 | 145 |
146 // Handles for the libcurl library | 146 // Handles for the libcurl library |
147 CURLM *curl_multi_handle_; | 147 CURLM *curl_multi_handle_; |
148 CURL *curl_handle_; | 148 CURL *curl_handle_; |
149 | 149 |
150 // a list of all file descriptors that we're waiting on from the | 150 // Lists of all read(0)/write(1) file descriptors that we're waiting on from |
151 // glib main loop | 151 // the glib main loop. libcurl may open/close descriptors and switch their |
| 152 // directions so maintain two separate lists so that watch conditions can be |
| 153 // set appropriately. |
152 typedef std::map<int, std::pair<GIOChannel*, guint> > IOChannels; | 154 typedef std::map<int, std::pair<GIOChannel*, guint> > IOChannels; |
153 IOChannels io_channels_; | 155 IOChannels io_channels_[2]; |
154 | 156 |
155 // if non-NULL, a timer we're waiting on. glib main loop will call us back | 157 // if non-NULL, a timer we're waiting on. glib main loop will call us back |
156 // when it fires. | 158 // when it fires. |
157 GSource* timeout_source_; | 159 GSource* timeout_source_; |
158 | 160 |
159 bool transfer_in_progress_; | 161 bool transfer_in_progress_; |
160 | 162 |
161 // The transfer size. -1 if not known. | 163 // The transfer size. -1 if not known. |
162 off_t transfer_size_; | 164 off_t transfer_size_; |
163 | 165 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // We can't clean everything up while we're in a write callback, so | 197 // We can't clean everything up while we're in a write callback, so |
196 // if we get a terminate request, queue it until we can handle it. | 198 // if we get a terminate request, queue it until we can handle it. |
197 bool terminate_requested_; | 199 bool terminate_requested_; |
198 | 200 |
199 DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher); | 201 DISALLOW_COPY_AND_ASSIGN(LibcurlHttpFetcher); |
200 }; | 202 }; |
201 | 203 |
202 } // namespace chromeos_update_engine | 204 } // namespace chromeos_update_engine |
203 | 205 |
204 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ | 206 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H__ |
OLD | NEW |