Create lobby even if the run callbacks function is never run.
parent
c4e0c855df
commit
794469c4cf
|
@ -19,21 +19,22 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
static void network_thread(Networking *network)
|
static void background_thread(Steam_Client *client)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("network thread starting\n");
|
PRINT_DEBUG("background thread starting\n");
|
||||||
while (1) {
|
while (1) {
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
global_mutex.lock();
|
global_mutex.lock();
|
||||||
if (!network->isAlive()) {
|
if (!client->network->isAlive()) {
|
||||||
global_mutex.unlock();
|
global_mutex.unlock();
|
||||||
//delete network;
|
//delete network;
|
||||||
PRINT_DEBUG("network thread exit\n");
|
PRINT_DEBUG("background thread exit\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUG("network thread run\n");
|
PRINT_DEBUG("background thread run\n");
|
||||||
network->Run();
|
client->network->Run();
|
||||||
|
client->steam_matchmaking->RunBackground();
|
||||||
global_mutex.unlock();
|
global_mutex.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1672,7 +1673,7 @@ void Steam_Client::UnregisterCallResult( class CCallbackBase *pCallback, SteamAP
|
||||||
void Steam_Client::RunCallbacks(bool runClientCB, bool runGameserverCB)
|
void Steam_Client::RunCallbacks(bool runClientCB, bool runGameserverCB)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!network_keepalive.joinable()) network_keepalive = std::thread(network_thread, network);
|
if (!background_keepalive.joinable()) background_keepalive = std::thread(background_thread, this);
|
||||||
|
|
||||||
network->Run();
|
network->Run();
|
||||||
PRINT_DEBUG("Steam_Client::RunCallbacks steam_matchmaking_servers\n");
|
PRINT_DEBUG("Steam_Client::RunCallbacks steam_matchmaking_servers\n");
|
||||||
|
|
|
@ -115,7 +115,7 @@ public:
|
||||||
|
|
||||||
bool user_logged_in = false;
|
bool user_logged_in = false;
|
||||||
bool server_init = false;
|
bool server_init = false;
|
||||||
std::thread network_keepalive;
|
std::thread background_keepalive;
|
||||||
|
|
||||||
Steam_Client();
|
Steam_Client();
|
||||||
~Steam_Client();
|
~Steam_Client();
|
||||||
|
|
|
@ -462,6 +462,7 @@ CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend )
|
||||||
bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource )
|
bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::IsUserInSource %llu %llu\n", steamIDUser.ConvertToUint64(), steamIDSource.ConvertToUint64());
|
PRINT_DEBUG("Steam_Friends::IsUserInSource %llu %llu\n", steamIDUser.ConvertToUint64(), steamIDSource.ConvertToUint64());
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (steamIDUser == settings->get_local_steam_id()) {
|
if (steamIDUser == settings->get_local_steam_id()) {
|
||||||
if (settings->get_lobby() == steamIDSource) {
|
if (settings->get_lobby() == steamIDSource) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1115,8 +1115,7 @@ bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunBackground()
|
||||||
void RunCallbacks()
|
|
||||||
{
|
{
|
||||||
remove_lobbies();
|
remove_lobbies();
|
||||||
Create_pending_lobbies();
|
Create_pending_lobbies();
|
||||||
|
@ -1125,6 +1124,11 @@ void RunCallbacks()
|
||||||
send_lobby_data();
|
send_lobby_data();
|
||||||
last_sent_lobbies = std::chrono::high_resolution_clock::now();
|
last_sent_lobbies = std::chrono::high_resolution_clock::now();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunCallbacks()
|
||||||
|
{
|
||||||
|
RunBackground();
|
||||||
|
|
||||||
if (searching) {
|
if (searching) {
|
||||||
PRINT_DEBUG("Searching for lobbies %zu\n", lobbies.size());
|
PRINT_DEBUG("Searching for lobbies %zu\n", lobbies.size());
|
||||||
|
|
Loading…
Reference in New Issue