* Send a content request for queued content info download. */
| 803 | * Send a content request for queued content info download. |
| 804 | */ |
| 805 | void ClientNetworkContentSocketHandler::RequestQueuedContentInfo() |
| 806 | { |
| 807 | if (this->queued.empty()) return; |
| 808 | |
| 809 | /* Wait until we've briefly stopped receiving data (which will contain more content) before making the request. */ |
| 810 | if (std::chrono::steady_clock::now() <= this->last_activity + CONTENT_QUEUE_TIMEOUT) { |
| 811 | _request_queue_timeout.Reset(); |
| 812 | return; |
| 813 | } |
| 814 | |
| 815 | /* Move the queue locally so more ids can be queued for later. */ |
| 816 | ContentIDList queue; |
| 817 | queue.swap(this->queued); |
| 818 | |
| 819 | /* Remove ids that have since been received since the request was queued. */ |
| 820 | queue.erase(std::remove_if(std::begin(queue), std::end(queue), [this](ContentID content_id) { |
| 821 | return std::ranges::find(this->infos, content_id, &ContentInfo::id) != std::end(this->infos); |
| 822 | }), std::end(queue)); |
| 823 | |
| 824 | this->RequestContentList(queue); |
| 825 | } |
| 826 | |
| 827 | /** |
| 828 | * Get the content info based on a ContentID |
no test coverage detected