Files
UnrealEngineUWP/Engine/Source/Programs/UnrealDisasterRecoveryService/Private/UnrealDisasterRecoveryService.cpp
patrick laflamme 542299e61b #jira UE-82395 - Disaster Recovery Log console pops behind the editor on Mac
- Added a option to configure whether the console should be shown, set it to false for Disaster Recovery.

#rb Trivial

#ROBOMERGE-SOURCE: CL 9823236 in //UE4/Release-4.24/...
#ROBOMERGE-BOT: RELEASE (Release-4.24 -> Main) (v546-9757112)

[CL 9823250 by patrick laflamme in Main branch]
2019-10-24 16:22:27 -04:00

60 lines
2.1 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "ConcertSettings.h"
#include "ConcertSyncServerLoop.h"
#include "RequiredProgramMainCPPInclude.h"
IMPLEMENT_APPLICATION(UnrealDisasterRecoveryService, "UnrealDisasterRecoveryService");
/**
* Application entry point
*
* @param ArgC Command-line argument count
* @param ArgV Argument strings
*/
INT32_MAIN_INT32_ARGC_TCHAR_ARGV()
{
uint32 EditorProcessId = 0;
FConcertSyncServerLoopInitArgs ServerLoopInitArgs;
ServerLoopInitArgs.IdealFramerate = 30;
ServerLoopInitArgs.SessionFlags = EConcertSyncSessionFlags::Default_DisasterRecoverySession;
ServerLoopInitArgs.ServiceRole = TEXT("DisasterRecovery");
ServerLoopInitArgs.ServiceFriendlyName = TEXT("Disaster Recovery Service");
ServerLoopInitArgs.ServiceAutoArchiveSessionFilter.bIncludeIgnoredActivities = true;
ServerLoopInitArgs.bShowConsole = false;
ServerLoopInitArgs.GetServerConfigFunc = [&EditorProcessId]() -> const UConcertServerConfig*
{
FParse::Value(FCommandLine::Get(), TEXT("-EDITORPID="), EditorProcessId);
if (EditorProcessId)
{
UE_LOG(LogSyncServer, Display, TEXT("Watching Editor process %d"), EditorProcessId);
}
else
{
UE_LOG(LogSyncServer, Error, TEXT("Invalid -EditorPID argument. Cannot continue!"));
return nullptr;
}
UConcertServerConfig* ServerConfig = IConcertSyncServerModule::Get().ParseServerSettings(FCommandLine::Get());
ServerConfig->bAutoArchiveOnReboot = true; // If server crashed, was killed, etc, ensure the recovery session is archived (expected by recovery flow).
ServerConfig->NumSessionsToKeep = 10;
ServerConfig->EndpointSettings.RemoteEndpointTimeoutSeconds = 0;
return ServerConfig;
};
FTicker::GetCoreTicker().AddTicker(TEXT("CheckEditorHealth"), 1.0f, [&EditorProcessId](float)
{
if (!FPlatformProcess::IsApplicationRunning(EditorProcessId))
{
UE_LOG(LogSyncServer, Warning, TEXT("Editor process %d lost! Requesting exit."), EditorProcessId);
FPlatformMisc::RequestExit(false);
}
return true;
});
return ConcertSyncServerLoop(ArgC, ArgV, ServerLoopInitArgs);
}