Mercurial > irccd
comparison irccdctl/main.cpp @ 428:ce1903f4bdb7 release-2.1
Fix #637: check for domain and family options
The decision was not clear between the two option names, the documentation
stated to use family but the code checked for family.
Accept both for compatibility purposes and unify the documentation using the
family name.
Task: #637
Errata: 20170218
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 18 Feb 2017 09:08:51 +0100 |
parents | c6fbb6e0e06d |
children | 9be4f8a5cf1a |
comparison
equal
deleted
inserted
replaced
427:e1373abccacb | 428:ce1903f4bdb7 |
---|---|
130 | 130 |
131 port = it->value(); | 131 port = it->value(); |
132 | 132 |
133 int domain = AF_INET; | 133 int domain = AF_INET; |
134 | 134 |
135 if ((it = sc.find("domain")) != sc.end()) { | 135 if ((it = sc.find("domain")) != sc.end() || (it = sc.find("family")) != sc.end()) { |
136 if (it->value() == "ipv6") { | 136 if (it->value() == "ipv6") { |
137 domain = AF_INET6; | 137 domain = AF_INET6; |
138 } else if (it->value() == "ipv4") { | 138 } else if (it->value() == "ipv4") { |
139 domain = AF_INET; | 139 domain = AF_INET; |
140 } else { | 140 } else { |
141 throw std::invalid_argument("invalid domain: " + it->value()); | 141 throw std::invalid_argument("invalid family: " + it->value()); |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 address = net::resolveOne(host, port, domain, SOCK_STREAM); | 145 address = net::resolveOne(host, port, domain, SOCK_STREAM); |
146 | 146 |