aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/servers/httpasio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenhttp/servers/httpasio.cpp')
-rw-r--r--src/zenhttp/servers/httpasio.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/zenhttp/servers/httpasio.cpp b/src/zenhttp/servers/httpasio.cpp
index e8b27da70..643f33618 100644
--- a/src/zenhttp/servers/httpasio.cpp
+++ b/src/zenhttp/servers/httpasio.cpp
@@ -2157,15 +2157,18 @@ HttpAsioServerImpl::Start(uint16_t Port, const AsioConfig& Config)
ZEN_INFO("starting asio http with {} service threads", Config.ThreadCount);
- m_Acceptor.reset(
- new asio_http::HttpAcceptor(*this, m_IoService, Port, Config.ForceLoopback, /*AllowPortProbing */ !Config.IsDedicatedServer));
-
- if (!m_Acceptor->IsValid())
+ if (!Config.NoNetwork)
{
- return 0;
- }
+ m_Acceptor.reset(
+ new asio_http::HttpAcceptor(*this, m_IoService, Port, Config.ForceLoopback, /*AllowPortProbing */ !Config.IsDedicatedServer));
+
+ if (!m_Acceptor->IsValid())
+ {
+ return 0;
+ }
- m_Acceptor->Start();
+ m_Acceptor->Start();
+ }
#if defined(ASIO_HAS_LOCAL_SOCKETS)
if (!Config.UnixSocketPath.empty())
@@ -2184,7 +2187,7 @@ HttpAsioServerImpl::Start(uint16_t Port, const AsioConfig& Config)
#endif
#if ZEN_USE_OPENSSL
- if (!Config.CertFile.empty() && !Config.KeyFile.empty())
+ if (!Config.NoNetwork && !Config.CertFile.empty() && !Config.KeyFile.empty())
{
m_SslContext = std::make_unique<asio::ssl::context>(asio::ssl::context::tlsv12_server);
m_SslContext->set_options(asio::ssl::context::default_workarounds | asio::ssl::context::no_sslv2 | asio::ssl::context::no_sslv3 |
@@ -2243,12 +2246,18 @@ HttpAsioServerImpl::Start(uint16_t Port, const AsioConfig& Config)
});
}
- ZEN_INFO("asio http started in {} mode, using {} threads on port {}",
- Config.IsDedicatedServer ? "DEDICATED" : "NORMAL",
- Config.ThreadCount,
- m_Acceptor->GetAcceptPort());
+ if (m_Acceptor)
+ {
+ ZEN_INFO("asio http started in {} mode, using {} threads on port {}",
+ Config.IsDedicatedServer ? "DEDICATED" : "NORMAL",
+ Config.ThreadCount,
+ m_Acceptor->GetAcceptPort());
+
+ return m_Acceptor->GetAcceptPort();
+ }
- return m_Acceptor->GetAcceptPort();
+ ZEN_INFO("asio http started in no-network mode, using {} threads (unix socket only)", Config.ThreadCount);
+ return Port;
}
void