mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-28 21:26:07 +00:00
refactor: prefer fmt logs
This commit is contained in:
parent
3b7d55f3c1
commit
e81639ca03
1 changed files with 28 additions and 28 deletions
|
@ -56,7 +56,7 @@ void SlippiMatchmaking::FindMatch(MatchSearchSettings settings)
|
||||||
{
|
{
|
||||||
isMmConnected = false;
|
isMmConnected = false;
|
||||||
|
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Starting matchmaking...");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Starting matchmaking...");
|
||||||
|
|
||||||
m_searchSettings = settings;
|
m_searchSettings = settings;
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
m_hostPort = userInfo.port;
|
m_hostPort = userInfo.port;
|
||||||
else
|
else
|
||||||
m_hostPort = 49000 + (generator() % 2000);
|
m_hostPort = 49000 + (generator() % 2000);
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Port to use: %d...", m_hostPort);
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Port to use: {}...", m_hostPort);
|
||||||
|
|
||||||
// We are explicitly setting the client address because we are trying to utilize our connection
|
// We are explicitly setting the client address because we are trying to utilize our connection
|
||||||
// to the matchmaking service in order to hole punch. This port will end up being the port
|
// to the matchmaking service in order to hole punch. This port will end up being the port
|
||||||
|
@ -240,7 +240,7 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
// Failed to create client
|
// Failed to create client
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = "Failed to create mm client";
|
m_errorMsg = "Failed to create mm client";
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Failed to create client...");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Failed to create client...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
// Failed to connect to server
|
// Failed to connect to server
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = "Failed to start connection to mm server";
|
m_errorMsg = "Failed to start connection to mm server";
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Failed to start connection to mm server...");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Failed to start connection to mm server...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
connectAttemptCount++;
|
connectAttemptCount++;
|
||||||
if (connectAttemptCount >= 20)
|
if (connectAttemptCount >= 20)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Failed to connect to mm server...");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Failed to connect to mm server...");
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = "Failed to connect to mm server";
|
m_errorMsg = "Failed to connect to mm server";
|
||||||
return;
|
return;
|
||||||
|
@ -283,14 +283,14 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
netEvent.peer->data = &userInfo.display_name;
|
netEvent.peer->data = &userInfo.display_name;
|
||||||
m_client->intercept = ENetUtil::InterceptCallback;
|
m_client->intercept = ENetUtil::InterceptCallback;
|
||||||
isMmConnected = true;
|
isMmConnected = true;
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Connected to mm server...");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Connected to mm server...");
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Trying to find match...");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Trying to find match...");
|
||||||
|
|
||||||
/*if (!m_user->IsLoggedIn())
|
/*if (!m_user->IsLoggedIn())
|
||||||
{
|
{
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Must be logged in to queue");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Must be logged in to queue");
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = "Must be logged in to queue. Go back to menu";
|
m_errorMsg = "Must be logged in to queue. Go back to menu";
|
||||||
return;
|
return;
|
||||||
|
@ -318,14 +318,14 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
hostname = gethostname(host, sizeof(host)); // find the host name
|
hostname = gethostname(host, sizeof(host)); // find the host name
|
||||||
if (hostname == -1)
|
if (hostname == -1)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Error finding LAN address");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Error finding LAN address");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
host_entry = gethostbyname(host); // find host information
|
host_entry = gethostbyname(host); // find host information
|
||||||
if (host_entry == NULL || host_entry->h_addrtype != AF_INET)
|
if (host_entry == NULL || host_entry->h_addrtype != AF_INET)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Error finding LAN host");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Error finding LAN host");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -361,7 +361,7 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
int rcvRes = receiveMessage(response, 5000);
|
int rcvRes = receiveMessage(response, 5000);
|
||||||
if (rcvRes != 0)
|
if (rcvRes != 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SLIPPI_ONLINE,
|
ERROR_LOG_FMT(SLIPPI_ONLINE,
|
||||||
"[Matchmaking] Did not receive response from server for create ticket");
|
"[Matchmaking] Did not receive response from server for create ticket");
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = "Failed to join mm queue";
|
m_errorMsg = "Failed to join mm queue";
|
||||||
|
@ -371,8 +371,8 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
std::string respType = response["type"];
|
std::string respType = response["type"];
|
||||||
if (respType != MmMessageType::CREATE_TICKET_RESP)
|
if (respType != MmMessageType::CREATE_TICKET_RESP)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Received incorrect response for create ticket");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Received incorrect response for create ticket");
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "%s", response.dump().c_str());
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "{}", response.dump().c_str());
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = "Invalid response when joining mm queue";
|
m_errorMsg = "Invalid response when joining mm queue";
|
||||||
return;
|
return;
|
||||||
|
@ -381,14 +381,14 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
std::string err = response.value("error", "");
|
std::string err = response.value("error", "");
|
||||||
if (err.length() > 0)
|
if (err.length() > 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Received error from server for create ticket");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Received error from server for create ticket");
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = err;
|
m_errorMsg = err;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_state = ProcessState::MATCHMAKING;
|
m_state = ProcessState::MATCHMAKING;
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Request ticket success");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Request ticket success");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlippiMatchmaking::handleMatchmaking()
|
void SlippiMatchmaking::handleMatchmaking()
|
||||||
|
@ -402,13 +402,13 @@ void SlippiMatchmaking::handleMatchmaking()
|
||||||
int rcvRes = receiveMessage(getResp, 2000);
|
int rcvRes = receiveMessage(getResp, 2000);
|
||||||
if (rcvRes == -1)
|
if (rcvRes == -1)
|
||||||
{
|
{
|
||||||
INFO_LOG(SLIPPI_ONLINE, "[Matchmaking] Have not yet received assignment");
|
INFO_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Have not yet received assignment");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (rcvRes != 0)
|
else if (rcvRes != 0)
|
||||||
{
|
{
|
||||||
// Right now the only other code is -2 meaning the server died probably?
|
// Right now the only other code is -2 meaning the server died probably?
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Lost connection to the mm server");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Lost connection to the mm server");
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = "Lost connection to the mm server";
|
m_errorMsg = "Lost connection to the mm server";
|
||||||
return;
|
return;
|
||||||
|
@ -417,7 +417,7 @@ void SlippiMatchmaking::handleMatchmaking()
|
||||||
std::string respType = getResp["type"];
|
std::string respType = getResp["type"];
|
||||||
if (respType != MmMessageType::GET_TICKET_RESP)
|
if (respType != MmMessageType::GET_TICKET_RESP)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Received incorrect response for get ticket");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Received incorrect response for get ticket");
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = "Invalid response when getting mm status";
|
m_errorMsg = "Invalid response when getting mm status";
|
||||||
return;
|
return;
|
||||||
|
@ -434,7 +434,7 @@ void SlippiMatchmaking::handleMatchmaking()
|
||||||
latestVersion); // Force latest version for people whose file updates dont work
|
latestVersion); // Force latest version for people whose file updates dont work
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Received error from server for get ticket");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Received error from server for get ticket");
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = err;
|
m_errorMsg = err;
|
||||||
return;
|
return;
|
||||||
|
@ -536,7 +536,7 @@ void SlippiMatchmaking::handleMatchmaking()
|
||||||
terminateMmConnection();
|
terminateMmConnection();
|
||||||
|
|
||||||
m_state = ProcessState::OPPONENT_CONNECTING;
|
m_state = ProcessState::OPPONENT_CONNECTING;
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Opponent found. isDecider: %s",
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Opponent found. isDecider: {}",
|
||||||
m_isHost ? "true" : "false");
|
m_isHost ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,7 +597,7 @@ void SlippiMatchmaking::handleConnecting()
|
||||||
{
|
{
|
||||||
ipLog << m_remoteIps[i] << ", ";
|
ipLog << m_remoteIps[i] << ", ";
|
||||||
}
|
}
|
||||||
// INFO_LOG(SLIPPI_ONLINE, "[Matchmaking] My port: %d || %s", m_hostPort, ipLog.str());
|
// INFO_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] My port: {} || {}", m_hostPort, ipLog.str());
|
||||||
|
|
||||||
// Is host is now used to specify who the decider is
|
// Is host is now used to specify who the decider is
|
||||||
auto client = std::make_unique<SlippiNetplayClient>(addrs, ports, remotePlayerCount, m_hostPort,
|
auto client = std::make_unique<SlippiNetplayClient>(addrs, ports, remotePlayerCount, m_hostPort,
|
||||||
|
@ -608,7 +608,7 @@ void SlippiMatchmaking::handleConnecting()
|
||||||
auto status = client->GetSlippiConnectStatus();
|
auto status = client->GetSlippiConnectStatus();
|
||||||
if (status == SlippiNetplayClient::SlippiConnectStatus::NET_CONNECT_STATUS_INITIATED)
|
if (status == SlippiNetplayClient::SlippiConnectStatus::NET_CONNECT_STATUS_INITIATED)
|
||||||
{
|
{
|
||||||
INFO_LOG(SLIPPI_ONLINE, "[Matchmaking] Connection not yet successful");
|
INFO_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Connection not yet successful");
|
||||||
Common::SleepCurrentThread(500);
|
Common::SleepCurrentThread(500);
|
||||||
|
|
||||||
// Deal with class shut down
|
// Deal with class shut down
|
||||||
|
@ -622,7 +622,7 @@ void SlippiMatchmaking::handleConnecting()
|
||||||
{
|
{
|
||||||
// If we failed setting up a connection in teams mode, show a detailed error about who we had
|
// If we failed setting up a connection in teams mode, show a detailed error about who we had
|
||||||
// issues connecting to.
|
// issues connecting to.
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Failed to connect to players");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Failed to connect to players");
|
||||||
m_state = ProcessState::ERROR_ENCOUNTERED;
|
m_state = ProcessState::ERROR_ENCOUNTERED;
|
||||||
m_errorMsg = "Timed out waiting for other players to connect";
|
m_errorMsg = "Timed out waiting for other players to connect";
|
||||||
auto failedConns = client->GetFailedConnections();
|
auto failedConns = client->GetFailedConnections();
|
||||||
|
@ -645,7 +645,7 @@ void SlippiMatchmaking::handleConnecting()
|
||||||
}
|
}
|
||||||
else if (status != SlippiNetplayClient::SlippiConnectStatus::NET_CONNECT_STATUS_CONNECTED)
|
else if (status != SlippiNetplayClient::SlippiConnectStatus::NET_CONNECT_STATUS_CONNECTED)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SLIPPI_ONLINE,
|
ERROR_LOG_FMT(SLIPPI_ONLINE,
|
||||||
"[Matchmaking] Connection attempt failed, looking for someone else.");
|
"[Matchmaking] Connection attempt failed, looking for someone else.");
|
||||||
|
|
||||||
// Return to the start to get a new ticket to find someone else we can hopefully connect with
|
// Return to the start to get a new ticket to find someone else we can hopefully connect with
|
||||||
|
@ -654,7 +654,7 @@ void SlippiMatchmaking::handleConnecting()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR_LOG(SLIPPI_ONLINE, "[Matchmaking] Connection success!");
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Connection success!");
|
||||||
|
|
||||||
// Successful connection
|
// Successful connection
|
||||||
m_netplayClient = std::move(client);
|
m_netplayClient = std::move(client);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue