void
NameAddTransaction::addingFwdAddrsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildAddFwdAddressRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildAddFwdAddressRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
void
NameAddTransaction::replacingFwdAddrsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case FQDN_IN_USE_EVT:
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildReplaceFwdAddressRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildReplaceFwdAddressRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
void
NameAddTransaction::replacingRevPtrsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildReplaceRevPtrsRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildReplaceRevPtrsRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
void
NameRemoveTransaction::removingFwdAddrsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildRemoveFwdAddressRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger,
- DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildRemoveFwdAddressRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
void
NameRemoveTransaction::removingFwdRRsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case UPDATE_OK_EVT:
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildRemoveFwdRRsRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger,
- DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildRemoveFwdRRsRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
void
NameRemoveTransaction::removingRevPtrsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildRemoveRevPtrsRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildRemoveRevPtrsRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
void
SimpleAddTransaction::replacingFwdAddrsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildReplaceFwdAddressRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildReplaceFwdAddressRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
void
SimpleAddTransaction::replacingRevPtrsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildReplaceRevPtrsRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildReplaceRevPtrsRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
void
SimpleRemoveTransaction::removingFwdRRsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case UPDATE_OK_EVT:
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildRemoveFwdRRsRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger,
- DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildRemoveFwdRRsRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
}
}
-
void
SimpleRemoveTransaction::selectingRevServerHandler() {
switch(getNextEvent()) {
void
SimpleRemoveTransaction::removingRevPtrsHandler() {
if (doOnEntry()) {
- // Clear the request on initial transition. This allows us to reuse
- // the request on retries if necessary.
- clearDnsUpdateRequest();
+ // Clear the update attempts count on initial transition.
+ clearUpdateAttempts();
}
+ // No reuse of the request on retries.
+ clearDnsUpdateRequest();
switch(getNextEvent()) {
case SERVER_SELECTED_EVT:
- if (!getDnsUpdateRequest()) {
- // Request hasn't been constructed yet, so build it.
- try {
- buildRemoveRevPtrsRequest();
- } catch (const std::exception& ex) {
- // While unlikely, the build might fail if we have invalid
- // data. Should that be the case, we need to fail the
- // transaction.
- LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE)
- .arg(getRequestId())
- .arg(getNcr()->toText())
- .arg(ex.what());
- transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
- break;
- }
+ try {
+ buildRemoveRevPtrsRequest();
+ } catch (const std::exception& ex) {
+ // While unlikely, the build might fail if we have invalid
+ // data. Should that be the case, we need to fail the
+ // transaction.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE)
+ .arg(getRequestId())
+ .arg(getNcr()->toText())
+ .arg(ex.what());
+ transition(PROCESS_TRANS_FAILED_ST, UPDATE_FAILED_EVT);
+ break;
}
// Call sendUpdate() to initiate the async send. Note it also sets
// value). This is roughly ten times the number for the longest
// test (currently, multiTransactionTimeout).
if (passes > max_passes) {
- ADD_FAILURE() << "processALL failed, too many passes: "
- << passes << ", total handlers executed: " << handlers;
+ FAIL() << "processALL failed, too many passes: "
+ << passes << ", total handlers executed: " << handlers;
}
}
}
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_add->getDnsUpdateRequest();
-
// Run addingFwdAddrsHandler to send the request.
EXPECT_NO_THROW(name_add->addingFwdAddrsHandler());
- const D2UpdateMessagePtr curr_msg = name_add->getDnsUpdateRequest();
- if (i == 1) {
- // First time out we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_add->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_add->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_add->getDnsUpdateRequest();
-
// Run replacingFwdAddrsHandler to send the request.
EXPECT_NO_THROW(name_add->replacingFwdAddrsHandler());
- const D2UpdateMessagePtr curr_msg = name_add->getDnsUpdateRequest();
- if (i == 1) {
- // First time out we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_add->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_add->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_add->getDnsUpdateRequest();
-
// Run replacingFwdAddrsHandler to send the request.
EXPECT_NO_THROW(name_add->replacingFwdAddrsHandler());
- const D2UpdateMessagePtr curr_msg = name_add->getDnsUpdateRequest();
- if (i == 1) {
- // First time out we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a corrupt server response.
name_add->setDnsUpdateStatus(DNSClient::INVALID_RESPONSE);
name_add->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_add->getDnsUpdateRequest();
-
// Run replacingRevPtrsHandler to send the request.
EXPECT_NO_THROW(name_add->replacingRevPtrsHandler());
- const D2UpdateMessagePtr curr_msg = name_add->getDnsUpdateRequest();
- if (i == 1) {
- // First time out we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_add->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_add->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_add->getDnsUpdateRequest();
-
// Run replacingRevPtrsHandler to send the request.
EXPECT_NO_THROW(name_add->replacingRevPtrsHandler());
- const D2UpdateMessagePtr curr_msg = name_add->getDnsUpdateRequest();
- if (i == 1) {
- // First time out we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server corrupt response.
name_add->setDnsUpdateStatus(DNSClient::INVALID_RESPONSE);
name_add->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_remove->getDnsUpdateRequest();
-
// Run removingFwdAddrsHandler to send the request.
EXPECT_NO_THROW(name_remove->removingFwdAddrsHandler());
- const D2UpdateMessagePtr curr_msg = name_remove->getDnsUpdateRequest();
- if (i == 1) {
- // First time around we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_remove->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_remove->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_remove->getDnsUpdateRequest();
-
// Run removingFwdRRsHandler to send the request.
EXPECT_NO_THROW(name_remove->removingFwdRRsHandler());
- const D2UpdateMessagePtr curr_msg = name_remove->getDnsUpdateRequest();
- if (i == 1) {
- // First time around we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_remove->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_remove->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_remove->getDnsUpdateRequest();
-
// Run removingFwdRRsHandler to send the request.
EXPECT_NO_THROW(name_remove->removingFwdRRsHandler());
- const D2UpdateMessagePtr curr_msg = name_remove->getDnsUpdateRequest();
- if (i == 1) {
- // First time around we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a corrupt server response.
name_remove->setDnsUpdateStatus(DNSClient::INVALID_RESPONSE);
name_remove->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_remove->getDnsUpdateRequest();
-
// Run removingRevPtrsHandler to send the request.
EXPECT_NO_THROW(name_remove->removingRevPtrsHandler());
- const D2UpdateMessagePtr curr_msg = name_remove->getDnsUpdateRequest();
- if (i == 1) {
- // First time around we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_remove->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_remove->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_remove->getDnsUpdateRequest();
-
// Run removingRevPtrsHandler to send the request.
EXPECT_NO_THROW(name_remove->removingRevPtrsHandler());
- const D2UpdateMessagePtr curr_msg = name_remove->getDnsUpdateRequest();
- if (i == 1) {
- // First time around we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server corrupt response.
name_remove->setDnsUpdateStatus(DNSClient::INVALID_RESPONSE);
name_remove->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_add->getDnsUpdateRequest();
-
// Run replacingFwdAddrsHandler to send the request.
EXPECT_NO_THROW(name_add->replacingFwdAddrsHandler());
- const D2UpdateMessagePtr curr_msg = name_add->getDnsUpdateRequest();
- if (i == 1) {
- // First time out we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_add->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_add->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_add->getDnsUpdateRequest();
-
// Run replacingFwdAddrsHandler to send the request.
EXPECT_NO_THROW(name_add->replacingFwdAddrsHandler());
- const D2UpdateMessagePtr curr_msg = name_add->getDnsUpdateRequest();
- if (i == 1) {
- // First time out we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a corrupt server response.
name_add->setDnsUpdateStatus(DNSClient::INVALID_RESPONSE);
name_add->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_add->getDnsUpdateRequest();
-
// Run replacingRevPtrsHandler to send the request.
EXPECT_NO_THROW(name_add->replacingRevPtrsHandler());
- const D2UpdateMessagePtr curr_msg = name_add->getDnsUpdateRequest();
- if (i == 1) {
- // First time out we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_add->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_add->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_add->getDnsUpdateRequest();
-
// Run replacingRevPtrsHandler to send the request.
EXPECT_NO_THROW(name_add->replacingRevPtrsHandler());
- const D2UpdateMessagePtr curr_msg = name_add->getDnsUpdateRequest();
- if (i == 1) {
- // First time out we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server corrupt response.
name_add->setDnsUpdateStatus(DNSClient::INVALID_RESPONSE);
name_add->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_remove->getDnsUpdateRequest();
-
// Run removingFwdRRsHandler to send the request.
EXPECT_NO_THROW(name_remove->removingFwdRRsHandler());
- const D2UpdateMessagePtr curr_msg = name_remove->getDnsUpdateRequest();
- if (i == 1) {
- // First time around we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_remove->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_remove->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_remove->getDnsUpdateRequest();
-
// Run removingFwdRRsHandler to send the request.
EXPECT_NO_THROW(name_remove->removingFwdRRsHandler());
- const D2UpdateMessagePtr curr_msg = name_remove->getDnsUpdateRequest();
- if (i == 1) {
- // First time around we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a corrupt server response.
name_remove->setDnsUpdateStatus(DNSClient::INVALID_RESPONSE);
name_remove->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_remove->getDnsUpdateRequest();
-
// Run removingRevPtrsHandler to send the request.
EXPECT_NO_THROW(name_remove->removingRevPtrsHandler());
- const D2UpdateMessagePtr curr_msg = name_remove->getDnsUpdateRequest();
- if (i == 1) {
- // First time around we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server IO timeout.
name_remove->setDnsUpdateStatus(DNSClient::TIMEOUT);
name_remove->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
// and then transition to selecting a new server.
int max_tries = NameChangeTransaction::MAX_UPDATE_TRIES_PER_SERVER;
for (int i = 1; i <= max_tries; ++i) {
- const D2UpdateMessagePtr prev_msg = name_remove->getDnsUpdateRequest();
-
// Run removingRevPtrsHandler to send the request.
EXPECT_NO_THROW(name_remove->removingRevPtrsHandler());
- const D2UpdateMessagePtr curr_msg = name_remove->getDnsUpdateRequest();
- if (i == 1) {
- // First time around we should build the message.
- EXPECT_FALSE(prev_msg);
- EXPECT_TRUE(curr_msg);
- } else {
- // Subsequent passes should reuse the request. We are only
- // looking to check that we have not replaced the pointer value
- // with a new pointer. This tests the on_entry() logic which
- // clears the request ONLY upon initial entry into the state.
- EXPECT_TRUE(prev_msg == curr_msg);
- }
-
// Simulate a server corrupt response.
name_remove->setDnsUpdateStatus(DNSClient::INVALID_RESPONSE);
name_remove->postNextEvent(NameChangeTransaction::IO_COMPLETED_EVT);
void
NameChangeTransaction::clearDnsUpdateRequest() {
- update_attempts_ = 0;
dns_update_request_.reset();
}
+void
+NameChangeTransaction::clearUpdateAttempts() {
+ update_attempts_ = 0;
+}
+
void
NameChangeTransaction::setDnsUpdateStatus(const DNSClient::Status& status) {
dns_update_status_ = status;
/// @param request is the new request packet to assign.
void setDnsUpdateRequest(D2UpdateMessagePtr& request);
- /// @brief Destroys the current update request packet and resets
- /// update attempts count.
+ /// @brief Destroys the current update request packet.
void clearDnsUpdateRequest();
+ /// @brief Resets the update attempts count.
+ void clearUpdateAttempts();
+
/// @brief Sets the update status to the given status value.
///
/// @param status is the new value for the update status.
using NameChangeTransaction::setNcrStatus;
using NameChangeTransaction::setDnsUpdateRequest;
using NameChangeTransaction::clearDnsUpdateRequest;
+ using NameChangeTransaction::clearUpdateAttempts;
using NameChangeTransaction::setDnsUpdateStatus;
using NameChangeTransaction::getDnsUpdateResponse;
using NameChangeTransaction::setDnsUpdateResponse;
// Verify that the value is as expected.
EXPECT_EQ(5, name_change->getUpdateAttempts());
+
+ // Clear it.
+ name_change->clearUpdateAttempts();
+
+ // Verify that it was cleared as expected.
+ EXPECT_EQ(0, name_change->getUpdateAttempts());
}
/// @brief Tests retryTransition method