From 71a52482f6c04e6734654a0c8b6008cbab7d0d59 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Mon, 28 Oct 2024 15:03:14 -0700 Subject: [PATCH] Issue#18: force family hint for TCP getaddr --- TCPReaderWriterClient.cpp | 2 +- ircddb/IRCClient.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/TCPReaderWriterClient.cpp b/TCPReaderWriterClient.cpp index 32fae7b..dcb4c0d 100644 --- a/TCPReaderWriterClient.cpp +++ b/TCPReaderWriterClient.cpp @@ -71,7 +71,7 @@ bool CTCPReaderWriterClient::Open() struct addrinfo hints; memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; + hints.ai_family = m_family; hints.ai_socktype = SOCK_STREAM; //hints.ai_flags = AI_PASSIVE; hints.ai_protocol = IPPROTO_TCP; diff --git a/ircddb/IRCClient.cpp b/ircddb/IRCClient.cpp index 2126ab6..55df6d8 100644 --- a/ircddb/IRCClient.cpp +++ b/ircddb/IRCClient.cpp @@ -73,8 +73,13 @@ void IRCClient::Entry() if (timer == 0) { timer = 30; + int fam = AF_UNSPEC; + if (0 == strcmp(host_name, "ircv4.openquad.net")) + fam = AF_INET; + else if (0 == strcmp(host_name, "ircv6.openquad.net")) + fam = AF_INET6; - if (! ircSock.Open(host_name, AF_UNSPEC, std::to_string(port))) + if (! ircSock.Open(host_name, fam, std::to_string(port))) { state = 4; timer = 0;