Commit 180f1f99 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[5189] Added a test for checking ClientConnection timeout in CA.

parent 193cd31c
......@@ -326,6 +326,18 @@ TEST_F(CtrlAgentCommandMgrTest, invalidAnswer) {
"{ \"result\": }");
}
/// Check that connection is dropped if it takes too long. The test checks
/// client's behavior when partial JSON is returned. Client will be waiting
/// for the '}' and will timeout because it is never received.
/// @todo Currently this test is disabled because we don't have configurable
/// timeout value. It is hardcoded to 5 sec, which is too long for the
/// unit test to run.
TEST_F(CtrlAgentCommandMgrTest, DISABLED_connectionTimeout) {
testForward(CtrlAgentCfgContext::TYPE_DHCP6, "dhcp6",
isc::config::CONTROL_RESULT_ERROR, -1, -1, 1,
"{ \"result\": 0");
}
/// Check that error is returned to the client if the forwarding socket is
/// not configured for the given service.
TEST_F(CtrlAgentCommandMgrTest, noClientSocket) {
......
......@@ -221,6 +221,7 @@ ClientConnectionImpl::terminate(const boost::system::error_code& ec,
ClientConnection::Handler handler) {
try {
timer_.cancel();
socket_.close();
current_command_.clear();
handler(ec, feed_);
......
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