[svn] commit: r2965 - in /branches/trac299: ./ src/bin/auth/auth_srv.cc src/bin/xfrout/xfrout.py.in src/lib/xfr/xfrout_client.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Sep 17 08:53:25 UTC 2010
Author: chenzhengzhang
Date: Fri Sep 17 08:53:25 2010
New Revision: 2965
Log:
create new branch for review
Added:
branches/trac299/
- copied from r2934, trunk/
Modified:
branches/trac299/src/bin/auth/auth_srv.cc
branches/trac299/src/bin/xfrout/xfrout.py.in
branches/trac299/src/lib/xfr/xfrout_client.cc
Modified: branches/trac299/src/bin/auth/auth_srv.cc
==============================================================================
--- branches/trac299/src/bin/auth/auth_srv.cc (original)
+++ branches/trac299/src/bin/auth/auth_srv.cc Fri Sep 17 08:53:25 2010
@@ -341,8 +341,12 @@
}
try {
- xfrout_client_.connect();
- xfrout_connected_ = true;
+ if (!xfrout_connected_)
+ {
+ xfrout_client_.connect();
+ xfrout_connected_ = true;
+ }
+
xfrout_client_.sendXfroutRequestInfo(
io_message.getSocket().getNative(),
io_message.getData(),
@@ -365,9 +369,6 @@
verbose_mode_);
return (true);
}
-
- xfrout_client_.disconnect();
- xfrout_connected_ = false;
return (false);
}
Modified: branches/trac299/src/bin/xfrout/xfrout.py.in
==============================================================================
--- branches/trac299/src/bin/xfrout/xfrout.py.in (original)
+++ branches/trac299/src/bin/xfrout/xfrout.py.in Fri Sep 17 08:53:25 2010
@@ -74,35 +74,40 @@
BaseRequestHandler.__init__(self, request, client_address, server)
def handle(self):
- fd = recv_fd(self.request.fileno())
-
- if fd < 0:
- # This may happen when one xfrout process try to connect to
- # xfrout unix socket server, to check whether there is another
- # xfrout running.
- self._log.log_message("error", "Failed to receive the file descriptor for XFR connection")
- return
-
- data_len = self.request.recv(2)
- msg_len = struct.unpack('!H', data_len)[0]
- msgdata = self.request.recv(msg_len)
- sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM)
- try:
- self.dns_xfrout_start(sock, msgdata)
- #TODO, avoid catching all exceptions
- except Exception as e:
- self._log.log_message("error", str(e))
-
- try:
- sock.shutdown(socket.SHUT_RDWR)
- except socket.error:
- # Avoid socket error caused by shutting down
- # one non-connected socket.
- pass
-
- sock.close()
- os.close(fd)
- pass
+ while True:
+ fd = recv_fd(self.request.fileno())
+
+ if fd < 0:
+ # This may happen when one xfrout process try to connect to
+ # xfrout unix socket server, to check whether there is another
+ # xfrout running.
+ #self._log.log_message("error", "Failed to receive the file descriptor for XFR connection")
+ #return
+ break
+
+ data_len = self.request.recv(2)
+ if not data_len:
+ break
+ msg_len = struct.unpack('!H', data_len)[0]
+ msgdata = self.request.recv(msg_len)
+ if not msgdata:
+ break
+ sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM)
+ try:
+ self.dns_xfrout_start(sock, msgdata)
+ #TODO, avoid catching all exceptions
+ except Exception as e:
+ self._log.log_message("error", str(e))
+
+ try:
+ sock.shutdown(socket.SHUT_RDWR)
+ except socket.error:
+ # Avoid socket error caused by shutting down
+ # one non-connected socket.
+ pass
+
+ sock.close()
+ os.close(fd)
def _parse_query_message(self, mdata):
''' parse query message to [socket,message]'''
Modified: branches/trac299/src/lib/xfr/xfrout_client.cc
==============================================================================
--- branches/trac299/src/lib/xfr/xfrout_client.cc (original)
+++ branches/trac299/src/lib/xfr/xfrout_client.cc Fri Sep 17 08:53:25 2010
@@ -95,12 +95,6 @@
"failed to send XFR request data to xfrout module");
}
- int databuf = 0;
- if (recv(impl_->socket_.native(), &databuf, sizeof(int), 0) != 0) {
- isc_throw(XfroutError,
- "xfr query hasn't been processed properly by xfrout module");
- }
-
return (0);
}
More information about the bind10-changes
mailing list