Commit 67a39b06 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[2977] Replaced inline protocol type check with cascaded check.

parent d406f570
...@@ -91,10 +91,18 @@ DNSClientImpl::DNSClientImpl(D2UpdateMessagePtr& response_placeholder, ...@@ -91,10 +91,18 @@ DNSClientImpl::DNSClientImpl(D2UpdateMessagePtr& response_placeholder,
// Given that we already eliminated the possibility that TCP is used, it // Given that we already eliminated the possibility that TCP is used, it
// would be sufficient to check that (proto != DNSClient::UDP). But, once // would be sufficient to check that (proto != DNSClient::UDP). But, once
// support TCP is added the check above will disappear and the extra check // support TCP is added the check above will disappear and the extra check
// will be needed here anyway. Why not add it now? // will be needed here anyway.
if (proto_ != DNSClient::TCP && proto_ != DNSClient::UDP) { // Note that cascaded check is used here instead of:
isc_throw(isc::NotImplemented, "invalid transport protocol type '" // if (proto_ != DNSClient::TCP && proto_ != DNSClient::UDP)..
<< proto_ << "' specified for DNS Updates"); // because some versions of GCC compiler complain that check above would
// be always 'false' due to limited range of enumeration. In fact, it is
// possible to pass out of range integral value through enum and it should
// be caught here.
if (proto_ != DNSClient::TCP) {
if (proto_ != DNSClient::UDP) {
isc_throw(isc::NotImplemented, "invalid transport protocol type '"
<< proto_ << "' specified for DNS Updates");
}
} }
if (!response_) { if (!response_) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment