OpenSSL channels now working

This commit is contained in:
2023-07-03 15:28:14 -04:00
parent a86eda5434
commit 7a95a6f3fc
2 changed files with 590 additions and 235 deletions

View File

@@ -18,7 +18,7 @@ AIntegrationGameModeBase::AIntegrationGameModeBase()
//PrimaryActorTick.bTickEvenWhenPaused = true; // Probably wrong //PrimaryActorTick.bTickEvenWhenPaused = true; // Probably wrong
//PrimaryActorTick.TickGroup = TG_PrePhysics; // Probably wrong //PrimaryActorTick.TickGroup = TG_PrePhysics; // Probably wrong
SetActorTickEnabled(true); SetActorTickEnabled(true);
SetActorTickInterval(0.05f); SetActorTickInterval(0.0f);
} }
AIntegrationGameModeBase::~AIntegrationGameModeBase() AIntegrationGameModeBase::~AIntegrationGameModeBase()
@@ -40,11 +40,11 @@ uint32 AIntegrationGameModeBase::Run()
engineutil::DPrint("Thread waiting a long time..."); engineutil::DPrint("Thread waiting a long time...");
continue; continue;
} }
engineutil::DPrint("Thread triggered.");
{ {
FScopeLock lk(&LuprexMutex); FScopeLock lk(&LuprexMutex);
Sockets->Update(); Sockets->Update();
Luprex.play_invoke_event_update(&Luprex, EngineSeconds); Luprex.play_invoke_event_update(&Luprex, EngineSeconds);
Sockets->Update();
} }
} }
return 0; return 0;
@@ -64,15 +64,15 @@ void AIntegrationGameModeBase::ResetToInitialState()
} }
ThreadStopRequested = false; ThreadStopRequested = false;
// Release and close all sockets.
Sockets.Reset();
// Delete the engine. // Delete the engine.
if (Luprex.release != nullptr) if (Luprex.release != nullptr)
{ {
Luprex.release(&Luprex); Luprex.release(&Luprex);
} }
// Release and close all sockets.
Sockets.Reset();
// Reset the clocks. // Reset the clocks.
EngineSeconds = 0; EngineSeconds = 0;
NextThreadTrigger = 1.0; NextThreadTrigger = 1.0;
@@ -115,7 +115,7 @@ void AIntegrationGameModeBase::Tick(float DeltaSeconds)
if ((Thread != nullptr) && (EngineSeconds >= NextThreadTrigger)) if ((Thread != nullptr) && (EngineSeconds >= NextThreadTrigger))
{ {
ThreadEvent->Trigger(); ThreadEvent->Trigger();
NextThreadTrigger += 1.0; NextThreadTrigger += 0.05;
} }
} }
@@ -170,7 +170,7 @@ void AIntegrationGameModeBase::BeginPlay()
} }
std::string_view srcpakv = srcpak.view(); std::string_view srcpakv = srcpak.view();
char* argv[1]; char* argv[1];
argv[0] = const_cast<char*>("lpxclient"); argv[0] = const_cast<char*>("lpxserver");
Luprex.play_initialize(&Luprex, 1, argv, srcpakv.size(), srcpakv.data(), ""); Luprex.play_initialize(&Luprex, 1, argv, srcpakv.size(), srcpakv.data(), "");
if (Luprex.error[0]) if (Luprex.error[0])
{ {
@@ -186,6 +186,8 @@ void AIntegrationGameModeBase::BeginPlay()
if (Luprex.engine != nullptr) if (Luprex.engine != nullptr)
{ {
Sockets.Reset(FLpxSockets::Create(&Luprex)); Sockets.Reset(FLpxSockets::Create(&Luprex));
std::string error = Sockets->GetError();
check(error.empty());
ThreadEvent = FPlatformProcess::GetSynchEventFromPool(false); ThreadEvent = FPlatformProcess::GetSynchEventFromPool(false);
Thread = FRunnableThread::Create(this, TEXT("Worker Thread")); Thread = FRunnableThread::Create(this, TEXT("Worker Thread"));
} }

File diff suppressed because it is too large Load Diff