SolidWallOfCode commented on code in PR #9530:
URL: https://github.com/apache/trafficserver/pull/9530#discussion_r1141026664
##########
lib/swoc/src/swoc_ip.cc:
##########
@@ -1055,11 +1055,9 @@ IP6Range::load(std::string_view text) {
IPRange::IPRange(IPAddr const &min, IPAddr const &max) {
if (min.is_ip4() && max.is_ip4()) {
- _range._ip4.assign(min.ip4(), max.ip4());
- _family = AF_INET;
+ this->assign(min.ip4(), max.ip4());
} else if (min.is_ip6() && max.is_ip6()) {
- _range._ip6.assign(min.ip6(), max.ip6());
- _family = AF_INET6;
+ this->assign(min.ip6(), max.ip6());
}
Review Comment:
I don't like constructors which throw, particularly inside ATS. Instead the
object should be constructed to some default / non-valid state. If this is a
concern, then you should use methods (which have return values indicating what
happened. A constructor like this is intended for use in situations where
there's no concern about data integrity, e.g. loading predefined values.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]