You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
*Reduces code duplication *Enables the same ODSC flow to be used for both COTF variants *The client will now autodetect if it should run in Zen mode or not #rb pj.kack,per.larsson #preflight 628c79bdf057b981ca479b3e [CL 20344832 by CarlMagnus Nordin in ue5-main branch]
81 lines
1.7 KiB
C++
81 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "HAL/ThreadSafeCounter.h"
|
|
#include "HAL/Runnable.h"
|
|
#include "CookOnTheFlyNetServerBase.h"
|
|
|
|
class FSocket;
|
|
|
|
|
|
/**
|
|
* This class wraps the server thread and network connection
|
|
*/
|
|
class FCookOnTheFlyServerTCP
|
|
: public FRunnable
|
|
, public FCookOnTheFlyNetworkServerBase
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* Creates and initializes a new instance.
|
|
*
|
|
* @param InFileServerOptions Network file server options
|
|
*/
|
|
FCookOnTheFlyServerTCP(int32 InPort, const TArray<ITargetPlatform*>& InTargetPlatforms, const FString& InZenProjectName);
|
|
|
|
/**
|
|
* Destructor.
|
|
*/
|
|
~FCookOnTheFlyServerTCP();
|
|
|
|
public:
|
|
|
|
// FRunnable Interface
|
|
|
|
virtual bool Init() override
|
|
{
|
|
return true;
|
|
}
|
|
|
|
virtual uint32 Run() override;
|
|
|
|
virtual void Stop() override
|
|
{
|
|
StopRequested.Set(true);
|
|
}
|
|
|
|
virtual void Exit() override;
|
|
|
|
// ICookOnTheFlyNetworkServer interface
|
|
|
|
virtual bool IsReadyToAcceptConnections(void) const override;
|
|
virtual bool GetAddressList(TArray<TSharedPtr<FInternetAddr>>& OutAddresses) const override;
|
|
virtual FString GetSupportedProtocol() const override;
|
|
virtual int32 NumConnections() const override;
|
|
virtual bool Start() override;
|
|
|
|
private:
|
|
int32 Port;
|
|
|
|
// Holds the server (listening) socket.
|
|
FSocket* Socket;
|
|
|
|
// Holds the server thread object.
|
|
FRunnableThread* Thread;
|
|
|
|
// Holds the list of all client connections.
|
|
TArray<class FCookOnTheFlyClientConnectionTCP*> Connections;
|
|
|
|
// Holds a flag indicating whether the thread should stop executing
|
|
FThreadSafeCounter StopRequested;
|
|
|
|
// Is the Listner thread up and running.
|
|
FThreadSafeCounter Running;
|
|
|
|
// Holds the address that the server is bound to.
|
|
TSharedPtr<FInternetAddr> ListenAddr;
|
|
};
|