You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Get GIsRequestingExit now by IsEngineRequestingExit() Set GIsRequestingExit now by RequestEngineExit(const TCHAR* Reason) or RequestEngineExit(const FString& Reason) NOTE If Reason is 4 or less chars it will generate an ensure to force a reason to exit The reason behind this change is right now setting GIsRequestingExit to true can cause many things to break mainly early on and with out any sort of log warning we have entered this state. We should wrap this behind a function to allow for proper handling #rb Chris.Babcock, Michael.Trepka, Michael.Noland #jira UE-79933 [FYI] Michael.Noland #ROBOMERGE-SOURCE: CL 8649683 via CL 8653683 #ROBOMERGE-BOT: (v417-8656536) [CL 8658680 by brandon schaefer in Main branch]
71 lines
1.7 KiB
C++
71 lines
1.7 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "UnrealFileServer.h"
|
|
|
|
#include "DirectoryWatcherModule.h"
|
|
#include "RequiredProgramMainCPPInclude.h"
|
|
#include "INetworkFileServer.h"
|
|
#include "INetworkFileSystemModule.h"
|
|
#include "IDirectoryWatcher.h"
|
|
#include "SocketSubsystem.h"
|
|
|
|
|
|
IMPLEMENT_APPLICATION(UnrealFileServer, "UnrealFileServer");
|
|
|
|
|
|
/**
|
|
* Application entry point
|
|
*
|
|
* @param ArgC Command-line argument count
|
|
* @param ArgV Argument strings
|
|
*/
|
|
INT32_MAIN_INT32_ARGC_TCHAR_ARGV()
|
|
{
|
|
// start up the main loop
|
|
GEngineLoop.PreInit(ArgC, ArgV);
|
|
|
|
check(GConfig && GConfig->IsReadyForUse());
|
|
|
|
#if PLATFORM_WINDOWS
|
|
// hide the console window, if desired
|
|
if (FParse::Param(FCommandLine::Get(), TEXT("HIDDEN")))
|
|
{
|
|
ShowWindow(GetConsoleWindow(), SW_HIDE);
|
|
}
|
|
#endif
|
|
|
|
// start the listening thread
|
|
INetworkFileServer* NetworkFileServer = FModuleManager::LoadModuleChecked<INetworkFileSystemModule>("NetworkFileSystem")
|
|
.CreateNetworkFileServer(false);
|
|
|
|
// loop while the server does the rest
|
|
double LastTime = FPlatformTime::Seconds();
|
|
|
|
while (!IsEngineExitRequested())
|
|
{
|
|
// let some time pass
|
|
FPlatformProcess::Sleep(1.0f);
|
|
|
|
double Now = FPlatformTime::Seconds();
|
|
float DeltaSeconds = LastTime - Now;
|
|
LastTime = Now;
|
|
|
|
// @todo: Put me into an FTicker that is created when the DW module is loaded
|
|
FDirectoryWatcherModule& DirectoryWatcherModule = FModuleManager::Get().LoadModuleChecked<FDirectoryWatcherModule>(TEXT("DirectoryWatcher"));
|
|
DirectoryWatcherModule.Get()->Tick(Now - LastTime);
|
|
|
|
GLog->FlushThreadedLogs();
|
|
|
|
LastTime = Now;
|
|
}
|
|
|
|
// shutdown the server
|
|
NetworkFileServer->Shutdown();
|
|
delete NetworkFileServer;
|
|
|
|
// Shutdown sockets layer
|
|
ISocketSubsystem::ShutdownAllSystems();
|
|
|
|
return 0;
|
|
}
|