mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 01:59:52 -06:00
Add Quality of Service (QoS) support
This commit is contained in:

committed by
Pierre Bourdon

parent
3cc64cc146
commit
41682a07cb
@ -33,4 +33,6 @@ const ConfigInfo<std::string> NETPLAY_SELECTED_HOST_GAME{
|
||||
{System::Main, "NetPlay", "SelectedHostGame"}, ""};
|
||||
const ConfigInfo<bool> NETPLAY_USE_UPNP{{System::Main, "NetPlay", "UseUPNP"}, false};
|
||||
|
||||
const ConfigInfo<bool> NETPLAY_ENABLE_QOS{{System::Main, "NetPlay", "EnableQoS"}, true};
|
||||
|
||||
} // namespace Config
|
||||
|
@ -29,4 +29,6 @@ extern const ConfigInfo<std::string> NETPLAY_NICKNAME;
|
||||
extern const ConfigInfo<std::string> NETPLAY_SELECTED_HOST_GAME;
|
||||
extern const ConfigInfo<bool> NETPLAY_USE_UPNP;
|
||||
|
||||
extern const ConfigInfo<bool> NETPLAY_ENABLE_QOS;
|
||||
|
||||
} // namespace Config
|
||||
|
@ -20,9 +20,11 @@
|
||||
#include "Common/ENetUtil.h"
|
||||
#include "Common/MD5.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/QoSSession.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Common/Version.h"
|
||||
#include "Core/Config/NetplaySettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/EXI/EXI_DeviceIPL.h"
|
||||
#include "Core/HW/SI/SI.h"
|
||||
@ -632,6 +634,17 @@ void NetPlayClient::SendAsync(sf::Packet&& packet)
|
||||
// called from ---NETPLAY--- thread
|
||||
void NetPlayClient::ThreadFunc()
|
||||
{
|
||||
Common::QoSSession qos_session;
|
||||
if (Config::Get(Config::NETPLAY_ENABLE_QOS))
|
||||
{
|
||||
qos_session = Common::QoSSession(m_server);
|
||||
|
||||
if (qos_session.Successful())
|
||||
m_dialog->AppendChat("Quality of Service (QoS) was successfully enabled.");
|
||||
else
|
||||
m_dialog->AppendChat("Quality of Service (QoS) couldn't be enabled.");
|
||||
}
|
||||
|
||||
while (m_do_loop.IsSet())
|
||||
{
|
||||
ENetEvent netEvent;
|
||||
|
@ -21,10 +21,12 @@
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/UPnP.h"
|
||||
#include "Common/Version.h"
|
||||
#include "Core/Config/NetplaySettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/Sram.h"
|
||||
#include "Core/NetPlayClient.h" //for NetPlayUI
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
@ -273,6 +275,7 @@ unsigned int NetPlayServer::OnConnect(ENetPeer* socket)
|
||||
Client player;
|
||||
player.pid = pid;
|
||||
player.socket = socket;
|
||||
|
||||
rpac >> player.revision;
|
||||
rpac >> player.name;
|
||||
|
||||
@ -343,10 +346,13 @@ unsigned int NetPlayServer::OnConnect(ENetPeer* socket)
|
||||
Send(player.socket, spac);
|
||||
}
|
||||
|
||||
if (Config::Get(Config::NETPLAY_ENABLE_QOS))
|
||||
player.qos_session = Common::QoSSession(player.socket);
|
||||
|
||||
// add client to the player list
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
|
||||
m_players.emplace(*(PlayerId*)player.socket->data, player);
|
||||
m_players.emplace(*(PlayerId*)player.socket->data, std::move(player));
|
||||
UpdatePadMapping(); // sync pad mappings with everyone
|
||||
UpdateWiimoteMapping();
|
||||
}
|
||||
|
@ -6,12 +6,14 @@
|
||||
|
||||
#include <SFML/Network/Packet.hpp>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include "Common/QoSSession.h"
|
||||
#include "Common/SPSCQueue.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Common/TraversalClient.h"
|
||||
@ -71,6 +73,8 @@ private:
|
||||
u32 ping;
|
||||
u32 current_game;
|
||||
|
||||
Common::QoSSession qos_session;
|
||||
|
||||
bool operator==(const Client& other) const { return this == &other; }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user