From b2fbb5ae8af82af7653b029ee6e225dd4461896e Mon Sep 17 00:00:00 2001 From: avigailo Date: Sun, 20 Apr 2025 13:54:01 +0300 Subject: [PATCH] Add prometheus support --- core/rest/rest_server.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/rest/rest_server.cc b/core/rest/rest_server.cc index b7b76b5..e71438d 100644 --- a/core/rest/rest_server.cc +++ b/core/rest/rest_server.cc @@ -163,11 +163,14 @@ RestServer::Impl::init() } } - bool is_ipv6 = getProfileAgentSettingWithDefault(false, "agent.rest.enableIpv6"); - if (is_ipv6) { + bool is_ipv6 = false; + if (accept_get_from_external_ip) { + is_ipv6 = true; fd = socket(AF_INET6, SOCK_STREAM, 0); - } else { + } + if (fd == -1) { fd = socket(AF_INET, SOCK_STREAM, 0); + is_ipv6 = false; } dbgAssert(fd >= 0) << alert << "Failed to open a socket";