mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Engine: properly deal with server frame thread commands/convars
Marked convars/concommands as FCVAR_SERVER_FRAME_THREAD and removed main thread dispatching code and comments that are no longer in effect. In the RCONServer execute handler, a ThreadJoinServerJob() is placed if the commandbase is flagged FCVAR_SERVER_FRAME_THREAD since RCON dispatches the command, or sets the convar directly.
This commit is contained in:
parent
32828e4e52
commit
83b1f43dbc
@ -523,6 +523,9 @@ void CRConServer::Execute(const cl_rcon::request& request) const
|
|||||||
|
|
||||||
const char* const pValueString = request.requestval().c_str();
|
const char* const pValueString = request.requestval().c_str();
|
||||||
|
|
||||||
|
if (pCommandBase->IsFlagSet(FCVAR_SERVER_FRAME_THREAD))
|
||||||
|
ThreadJoinServerJob();
|
||||||
|
|
||||||
if (!pCommandBase->IsCommand())
|
if (!pCommandBase->IsCommand())
|
||||||
{
|
{
|
||||||
// Here we want to skip over the command string in the value buffer.
|
// Here we want to skip over the command string in the value buffer.
|
||||||
|
@ -128,12 +128,18 @@ bool Detour_IsLoaded()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Detour_HotSwap()
|
void Detour_HotSwap()
|
||||||
{
|
{
|
||||||
|
Assert(ThreadInMainOrServerFrameThread());
|
||||||
|
|
||||||
|
// TODO: CodeCallback_OnNavMeshHotSwapStart()
|
||||||
|
|
||||||
// Free and re-init NavMesh.
|
// Free and re-init NavMesh.
|
||||||
Detour_LevelShutdown();
|
Detour_LevelShutdown();
|
||||||
v_Detour_LevelInit();
|
v_Detour_LevelInit();
|
||||||
|
|
||||||
if (!Detour_IsLoaded())
|
if (!Detour_IsLoaded())
|
||||||
Error(eDLL_T::SERVER, NOERROR, "%s - Failed to hot swap NavMesh\n", __FUNCTION__);
|
Error(eDLL_T::SERVER, NOERROR, "%s - Failed to hot swap NavMesh\n", __FUNCTION__);
|
||||||
|
|
||||||
|
// TODO: CodeCallback_OnNavMeshHotSwapEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -161,7 +167,7 @@ static void Detour_HotSwap_f()
|
|||||||
Msg(eDLL_T::SERVER, "Hot swap took '%lf' seconds\n", timer.GetDuration().GetSeconds());
|
Msg(eDLL_T::SERVER, "Hot swap took '%lf' seconds\n", timer.GetDuration().GetSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConCommand navmesh_hotswap("navmesh_hotswap", Detour_HotSwap_f, "Hot swap the NavMesh for all hulls", FCVAR_DEVELOPMENTONLY);
|
static ConCommand navmesh_hotswap("navmesh_hotswap", Detour_HotSwap_f, "Hot swap the NavMesh for all hulls", FCVAR_DEVELOPMENTONLY | FCVAR_SERVER_FRAME_THREAD);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void VRecast::Detour(const bool bAttach) const
|
void VRecast::Detour(const bool bAttach) const
|
||||||
|
@ -34,7 +34,7 @@ static void SQVM_ServerScript_f(const CCommand& args)
|
|||||||
Script_Execute(args.ArgS(), SQCONTEXT::SERVER);
|
Script_Execute(args.ArgS(), SQCONTEXT::SERVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static ConCommand script("script", SQVM_ServerScript_f, "Run input code as SERVER script on the VM", FCVAR_DEVELOPMENTONLY | FCVAR_GAMEDLL | FCVAR_CHEAT);
|
static ConCommand script("script", SQVM_ServerScript_f, "Run input code as SERVER script on the VM", FCVAR_DEVELOPMENTONLY | FCVAR_GAMEDLL | FCVAR_CHEAT | FCVAR_SERVER_FRAME_THREAD);
|
||||||
|
|
||||||
namespace VScriptCode
|
namespace VScriptCode
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static void LiveAPI_ParamsChangedCallback(IConVar* var, const char* pOldValue)
|
static void LiveAPI_ParamsChangedCallback(IConVar* var, const char* pOldValue)
|
||||||
{
|
{
|
||||||
// TODO[ AMOS ]: latch this off to the server frame thread!
|
|
||||||
LiveAPISystem()->UpdateParams();
|
LiveAPISystem()->UpdateParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +23,6 @@ static void LiveAPI_ParamsChangedCallback(IConVar* var, const char* pOldValue)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static void LiveAPI_AddressChangedCallback(IConVar* var, const char* pOldValue)
|
static void LiveAPI_AddressChangedCallback(IConVar* var, const char* pOldValue)
|
||||||
{
|
{
|
||||||
// TODO[ AMOS ]: latch this off to the server frame thread!
|
|
||||||
LiveAPISystem()->InstallAddressList();
|
LiveAPISystem()->InstallAddressList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,17 +133,7 @@ SQBool Script_PrecompileClientScripts(CSquirrelVM* vm)
|
|||||||
void Script_Execute(const SQChar* code, const SQCONTEXT context)
|
void Script_Execute(const SQChar* code, const SQCONTEXT context)
|
||||||
{
|
{
|
||||||
Assert(context != SQCONTEXT::NONE);
|
Assert(context != SQCONTEXT::NONE);
|
||||||
|
Assert(ThreadInMainOrServerFrameThread());
|
||||||
if (!ThreadInMainThread()) // TODO[ AMOS ]: server frame thread
|
|
||||||
{
|
|
||||||
const string scode(code);
|
|
||||||
g_TaskQueue.Dispatch([scode, context]()
|
|
||||||
{
|
|
||||||
Script_Execute(scode.c_str(), context);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
return; // Only run in main thread.
|
|
||||||
}
|
|
||||||
|
|
||||||
CSquirrelVM* s = Script_GetScriptHandle(context);
|
CSquirrelVM* s = Script_GetScriptHandle(context);
|
||||||
const char* const contextName = s_scriptContextNames[(int)context];
|
const char* const contextName = s_scriptContextNames[(int)context];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user