MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / RequestQueuedContentInfo

Method RequestQueuedContentInfo

src/network/network_content.cpp:805–825  ·  view source on GitHub ↗

* Send a content request for queued content info download. */

Source from the content-addressed store, hash-verified

803 * Send a content request for queued content info download.
804 */
805void 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

Callers 1

Calls 8

RequestContentListMethod · 0.95
nowClass · 0.85
beginFunction · 0.50
endFunction · 0.50
findFunction · 0.50
emptyMethod · 0.45
ResetMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected