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

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

parent d406f570
......@@ -91,11 +91,19 @@ DNSClientImpl::DNSClientImpl(D2UpdateMessagePtr& response_placeholder,
// Given that we already eliminated the possibility that TCP is used, it
// would be sufficient to check that (proto != DNSClient::UDP). But, once
// support TCP is added the check above will disappear and the extra check
// will be needed here anyway. Why not add it now?
if (proto_ != DNSClient::TCP && proto_ != DNSClient::UDP) {
// will be needed here anyway.
// Note that cascaded check is used here instead of:
// if (proto_ != DNSClient::TCP && proto_ != DNSClient::UDP)..
// 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_) {
isc_throw(BadValue, "a pointer to an object to encapsulate the DNS"
......
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