Enable IPv6 support for ZMQ server

This commit is contained in:
jpk68
2026-01-24 20:24:09 -05:00
parent f65b286455
commit 494a2145d1

View File

@@ -48,6 +48,7 @@ namespace
constexpr const int num_zmq_threads = 1;
constexpr const std::int64_t max_message_size = 10 * 1024 * 1024; // 10 MiB
constexpr const std::chrono::seconds linger_timeout{2}; // wait period for pending out messages
constexpr const int ipv6_option = 1;
net::zmq::socket init_socket(void* context, int type, epee::span<const std::string> addresses)
{
@@ -75,6 +76,12 @@ namespace
return nullptr;
}
if (zmq_setsockopt(out.get(), ZMQ_IPV6, std::addressof(ipv6_option), sizeof(ipv6_option)) != 0)
{
MONERO_LOG_ZMQ_ERROR("Failed to enable IPv6");
return nullptr;
}
for (const std::string& address : addresses)
{
if (zmq_bind(out.get(), address.c_str()) < 0)