mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-23 23:37:48 -05:00
Server freed from ResourceManager
Commit amended to revert OpenRGBInterfaces.h header (may reconsider in the future) by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "NetworkServer.h"
|
||||
#include "ResourceManager.h"
|
||||
#include <cstring>
|
||||
|
||||
#ifndef WIN32
|
||||
@@ -40,6 +39,7 @@ NetworkServer::NetworkServer(std::vector<RGBController *>& control) : controller
|
||||
server_online = false;
|
||||
server_listening = false;
|
||||
ConnectionThread = nullptr;
|
||||
profile_manager = nullptr;
|
||||
}
|
||||
|
||||
NetworkServer::~NetworkServer()
|
||||
@@ -683,7 +683,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
break;
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetProfileManager()->SaveProfile(data);
|
||||
if(profile_manager)
|
||||
{
|
||||
profile_manager->SaveProfile(data);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -693,9 +696,12 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
break;
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetProfileManager()->LoadProfile(data);
|
||||
if(profile_manager)
|
||||
{
|
||||
profile_manager->LoadProfile(data);
|
||||
}
|
||||
|
||||
for(RGBController* controller : ResourceManager::get()->GetRGBControllers())
|
||||
for(RGBController* controller : controllers)
|
||||
{
|
||||
controller->UpdateLEDs();
|
||||
}
|
||||
@@ -708,7 +714,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
break;
|
||||
}
|
||||
|
||||
ResourceManager::get()->GetProfileManager()->DeleteProfile(data);
|
||||
if(profile_manager)
|
||||
{
|
||||
profile_manager->DeleteProfile(data);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -876,7 +885,10 @@ void NetworkServer::SendRequest_DeviceListChanged(SOCKET client_sock)
|
||||
|
||||
void NetworkServer::SendReply_ProfileList(SOCKET client_sock)
|
||||
{
|
||||
ProfileManager* profile_manager = ResourceManager::get()->GetProfileManager();
|
||||
if(!profile_manager)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NetPacketHeader reply_hdr;
|
||||
unsigned char *reply_data = profile_manager->GetProfileListDescription();
|
||||
@@ -897,3 +909,8 @@ void NetworkServer::SendReply_ProfileList(SOCKET client_sock)
|
||||
send(client_sock, (const char *)reply_data, reply_size, 0);
|
||||
}
|
||||
|
||||
void NetworkServer::SetProfileManager(ProfileManagerInterface* profile_manager_pointer)
|
||||
{
|
||||
profile_manager = profile_manager_pointer;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user