* Actually begin downloading the content we selected. * @param[out] files The number of files we are going to download. * @param[out] bytes The number of bytes we are going to download. * @param fallback Whether to use the fallback or not. */
| 290 | * @param fallback Whether to use the fallback or not. |
| 291 | */ |
| 292 | void ClientNetworkContentSocketHandler::DownloadSelectedContent(uint &files, uint &bytes, bool fallback) |
| 293 | { |
| 294 | bytes = 0; |
| 295 | |
| 296 | ContentIDList content; |
| 297 | for (const auto &ci : this->infos) { |
| 298 | if (!ci->IsSelected() || ci->state == ContentInfo::State::AlreadyHere) continue; |
| 299 | |
| 300 | content.push_back(ci->id); |
| 301 | bytes += ci->filesize; |
| 302 | } |
| 303 | |
| 304 | files = (uint)content.size(); |
| 305 | |
| 306 | /* If there's nothing to download, do nothing. */ |
| 307 | if (files == 0) return; |
| 308 | |
| 309 | this->is_cancelled = false; |
| 310 | |
| 311 | if (fallback) { |
| 312 | this->DownloadSelectedContentFallback(content); |
| 313 | } else { |
| 314 | this->DownloadSelectedContentHTTP(content); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /** |
| 319 | * Initiate downloading the content over HTTP. |
no test coverage detected