From 40b85488dc88318bb610c1c4daff41fdb6725c22 Mon Sep 17 00:00:00 2001 From: Kyle Schwarz Date: Wed, 11 Dec 2024 17:25:36 -0500 Subject: [PATCH] TCP: Add LIBICSNEO_DISABLE_TCP env option --- platform/tcp.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/platform/tcp.cpp b/platform/tcp.cpp index 85bddcc..1f44202 100644 --- a/platform/tcp.cpp +++ b/platform/tcp.cpp @@ -88,6 +88,21 @@ void TCP::Socket::poll(uint16_t event, uint32_t msTimeout) { } void TCP::Find(std::vector& found) { + static const auto tcpDisabled = []() -> bool { + #ifdef _MSC_VER + #pragma warning(push) + #pragma warning(disable : 4996) + #endif + const auto disabled = std::getenv("LIBICSNEO_DISABLE_TCP"); + return disabled ? std::stoi(disabled) : false; + #ifdef _MSC_VER + #pragma warning(pop) + #endif + }; + if(tcpDisabled()) { + return; + } + static const auto MDNS_PORT = htons((unsigned short)5353); static const auto MDNS_IP = htonl((((uint32_t)224U) << 24U) | ((uint32_t)251U));