summaryrefslogtreecommitdiff
path: root/src/network/network_gamelist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/network_gamelist.cpp')
-rw-r--r--src/network/network_gamelist.cpp64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/network/network_gamelist.cpp b/src/network/network_gamelist.cpp
index b4f34983f..92964bf25 100644
--- a/src/network/network_gamelist.cpp
+++ b/src/network/network_gamelist.cpp
@@ -23,45 +23,6 @@
NetworkGameList *_network_game_list = nullptr; ///< Game list of this client.
int _network_game_list_version = 0; ///< Current version of all items in the list.
-/** The games to insert when the GUI thread has time for us. */
-static std::atomic<NetworkGameList *> _network_game_delayed_insertion_list(nullptr);
-
-/**
- * Add a new item to the linked gamelist, but do it delayed in the next tick
- * or so to prevent race conditions.
- * @param item the item to add. Will be freed once added.
- */
-void NetworkGameListAddItemDelayed(NetworkGameList *item)
-{
- item->next = _network_game_delayed_insertion_list.load(std::memory_order_relaxed);
- while (!_network_game_delayed_insertion_list.compare_exchange_weak(item->next, item, std::memory_order_acq_rel)) {}
-}
-
-/** Perform the delayed (thread safe) insertion into the game list */
-static void NetworkGameListHandleDelayedInsert()
-{
- while (true) {
- NetworkGameList *ins_item = _network_game_delayed_insertion_list.load(std::memory_order_relaxed);
- while (ins_item != nullptr && !_network_game_delayed_insertion_list.compare_exchange_weak(ins_item, ins_item->next, std::memory_order_acq_rel)) {}
- if (ins_item == nullptr) break; // No item left.
-
- NetworkGameList *item = NetworkGameListAddItem(ins_item->connection_string);
-
- if (item != nullptr) {
- if (item->info.server_name.empty()) {
- ClearGRFConfigList(&item->info.grfconfig);
- item->info = {};
- item->info.server_name = ins_item->info.server_name;
- item->online = false;
- }
- item->manually |= ins_item->manually;
- if (item->manually) NetworkRebuildHostList();
- UpdateNetworkGameWindow();
- }
- delete ins_item;
- }
-}
-
/**
* Add a new item to the linked gamelist. If the IP and Port match
* return the existing item instead of adding it again
@@ -149,31 +110,6 @@ void NetworkGameListRemoveExpired()
UpdateNetworkGameWindow();
}
-static const uint MAX_GAME_LIST_REQUERY_COUNT = 10; ///< How often do we requery in number of times per server?
-static const uint REQUERY_EVERY_X_GAMELOOPS = 60; ///< How often do we requery in time?
-static const uint REFRESH_GAMEINFO_X_REQUERIES = 50; ///< Refresh the game info itself after REFRESH_GAMEINFO_X_REQUERIES * REQUERY_EVERY_X_GAMELOOPS game loops
-
-/** Requeries the (game) servers we have not gotten a reply from */
-void NetworkGameListRequery()
-{
- NetworkGameListHandleDelayedInsert();
-
- static uint8 requery_cnt = 0;
-
- if (++requery_cnt < REQUERY_EVERY_X_GAMELOOPS) return;
- requery_cnt = 0;
-
- for (NetworkGameList *item = _network_game_list; item != nullptr; item = item->next) {
- item->retries++;
- if (item->retries < REFRESH_GAMEINFO_X_REQUERIES && (item->online || item->retries >= MAX_GAME_LIST_REQUERY_COUNT)) continue;
-
- /* item gets mostly zeroed by NetworkUDPQueryServer */
- uint8 retries = item->retries;
- NetworkUDPQueryServer(item->connection_string);
- item->retries = (retries >= REFRESH_GAMEINFO_X_REQUERIES) ? 0 : retries;
- }
-}
-
/**
* Rebuild the GRFConfig's of the servers in the game list as we did
* a rescan and might have found new NewGRFs.