From 8ce0478145e887088c1988d01847ef0b73be199d Mon Sep 17 00:00:00 2001 From: Per Larsson Date: Tue, 8 Mar 2022 08:59:29 +0100 Subject: Added streaming version of GetCacheRecords. --- zenhttp/websocketasio.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'zenhttp/websocketasio.cpp') diff --git a/zenhttp/websocketasio.cpp b/zenhttp/websocketasio.cpp index 5407f8bc6..5a47d0ea9 100644 --- a/zenhttp/websocketasio.cpp +++ b/zenhttp/websocketasio.cpp @@ -27,6 +27,10 @@ ZEN_THIRD_PARTY_INCLUDES_START #include ZEN_THIRD_PARTY_INCLUDES_END +#if ZEN_PLATFORM_WINDOWS +# include +#endif + namespace zen::websocket { using namespace std::literals; @@ -654,6 +658,25 @@ WsServer::Run() m_Acceptor->set_option(asio::socket_base::receive_buffer_size(ReceiveBufferSize)); m_Acceptor->set_option(asio::socket_base::send_buffer_size(SendBufferSize)); +#if ZEN_PLATFORM_WINDOWS + // On Windows, loopback connections can take advantage of a faster code path optionally with this flag. + // This must be used by both the client and server side, and is only effective in the absence of + // Windows Filtering Platform (WFP) callouts which can be installed by security software. + // https://docs.microsoft.com/en-us/windows/win32/winsock/sio-loopback-fast-path + SOCKET NativeSocket = m_Acceptor->native_handle(); + int LoopbackOptionValue = 1; + DWORD OptionNumberOfBytesReturned = 0; + WSAIoctl(NativeSocket, + SIO_LOOPBACK_FAST_PATH, + &LoopbackOptionValue, + sizeof(LoopbackOptionValue), + NULL, + 0, + &OptionNumberOfBytesReturned, + 0, + 0); +#endif + asio::error_code Ec; m_Acceptor->bind(asio::ip::tcp::endpoint(asio::ip::address_v6::any(), m_Options.Port), Ec); -- cgit v1.2.3