Browse Source

This is a quick fix patch for the issue: AXFR fails half the time because of connection problems. xfrout client will make a new connection every time.

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2697 e5f2f494-b856-4b98-b285-d166d9295462
Jerry 14 years ago
parent
commit
553ecf7478
3 changed files with 15 additions and 6 deletions
  1. 5 0
      ChangeLog
  2. 6 4
      src/bin/auth/auth_srv.cc
  3. 4 2
      src/bin/auth/tests/auth_srv_unittest.cc

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+  84.   [bug]       jinmei, jerry
+    This is a quick fix patch for the issue: AXFR fails half the 
+	time because of connection problems. xfrout client will make
+	a new connection every time. (svn r2697)
+
   83.	[build]*
 	The configure --with-boost-lib option is removed. It was not
 	used since the build included ASIO. (svn r2684)

+ 6 - 4
src/bin/auth/auth_srv.cc

@@ -342,10 +342,8 @@ AuthSrvImpl::processAxfrQuery(const IOMessage& io_message, Message& message,
     }
 
     try {
-        if (!xfrout_connected_) {
-            xfrout_client_.connect();
-            xfrout_connected_ = true;
-        }
+        xfrout_client_.connect();
+        xfrout_connected_ = true;
         xfrout_client_.sendXfroutRequestInfo(
             io_message.getSocket().getNative(),
             io_message.getData(),
@@ -368,6 +366,10 @@ AuthSrvImpl::processAxfrQuery(const IOMessage& io_message, Message& message,
                          verbose_mode_);
         return (true);
     }
+
+    xfrout_client_.disconnect();
+    xfrout_connected_ = false;
+
     return (false);
 }
 

+ 4 - 2
src/bin/auth/tests/auth_srv_unittest.cc

@@ -469,7 +469,7 @@ TEST_F(AuthSrvTest, AXFRSuccess) {
     // so we shouldn't have to respond.
     EXPECT_EQ(false, server.processMessage(*io_message, parse_message,
                                            response_renderer));
-    EXPECT_TRUE(xfrout.isConnected());
+    EXPECT_FALSE(xfrout.isConnected());
 }
 
 TEST_F(AuthSrvTest, AXFRConnectFail) {
@@ -481,6 +481,8 @@ TEST_F(AuthSrvTest, AXFRConnectFail) {
                                       response_renderer));
     headerCheck(parse_message, default_qid, Rcode::SERVFAIL(),
                 opcode.getCode(), QR_FLAG, 1, 0, 0, 0);
+    // For a shot term workaround with xfrout we currently close the connection
+    // for each AXFR attempt
     EXPECT_FALSE(xfrout.isConnected());
 }
 
@@ -490,7 +492,7 @@ TEST_F(AuthSrvTest, AXFRSendFail) {
     createRequestPacket(opcode, Name("example.com"), RRClass::IN(),
                         RRType::AXFR(), IPPROTO_TCP);
     server.processMessage(*io_message, parse_message, response_renderer);
-    EXPECT_TRUE(xfrout.isConnected());
+    EXPECT_FALSE(xfrout.isConnected()); // see above
 
     xfrout.disableSend();
     parse_message.clear(Message::PARSE);