// Copyright Epic Games, Inc. All Rights Reserved. #include "httpnull.h" #include #if ZEN_PLATFORM_WINDOWS # include #endif namespace zen { HttpNullServer::HttpNullServer() { } HttpNullServer::~HttpNullServer() { } void HttpNullServer::OnRegisterService(HttpService& Service) { ZEN_UNUSED(Service); } void HttpNullServer::OnSetHttpRequestFilter(IHttpRequestFilter* RequestFilter) { ZEN_UNUSED(RequestFilter); } int HttpNullServer::OnInitialize(int BasePort, std::filesystem::path DataDir) { ZEN_UNUSED(DataDir); return BasePort; } void HttpNullServer::OnRun(bool IsInteractiveSession) { const int WaitTimeout = 1000; bool ShutdownRequested = false; #if ZEN_PLATFORM_WINDOWS if (IsInteractiveSession) { ZEN_CONSOLE("Zen Server running (null HTTP). Press ESC or Q to quit"); } do { if (IsInteractiveSession && _kbhit() != 0) { char c = (char)_getch(); if (c == 27 || c == 'Q' || c == 'q') { m_ShutdownEvent.Set(); RequestApplicationExit(0); } } ShutdownRequested = m_ShutdownEvent.Wait(WaitTimeout); } while (!ShutdownRequested); #else if (IsInteractiveSession) { ZEN_CONSOLE("Zen Server running (null HTTP). Ctrl-C to quit"); } do { ShutdownRequested = m_ShutdownEvent.Wait(WaitTimeout); } while (!ShutdownRequested); #endif } void HttpNullServer::OnRequestExit() { m_ShutdownEvent.Set(); } void HttpNullServer::OnClose() { } } // namespace zen