[svn] commit: r3395 - in /branches/trac299/src: bin/auth/auth_srv.cc bin/xfrout/tests/xfrout_test.py bin/xfrout/xfrout.py.in bin/zonemgr/zonemgr.py.in lib/xfr/fd_share.cc lib/xfr/fd_share.h lib/xfr/fdshare_python.cc lib/xfr/xfrout_client.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Oct 29 03:33:39 UTC 2010
Author: chenzhengzhang
Date: Fri Oct 29 03:33:39 2010
New Revision: 3395
Log:
update code according to review comments:
* update unittest
* fix race condition
* use constant instead of headcoded value
* remove redundant white spaces at EOLs or in blank lines
Modified:
branches/trac299/src/bin/auth/auth_srv.cc
branches/trac299/src/bin/xfrout/tests/xfrout_test.py
branches/trac299/src/bin/xfrout/xfrout.py.in
branches/trac299/src/bin/zonemgr/zonemgr.py.in
branches/trac299/src/lib/xfr/fd_share.cc
branches/trac299/src/lib/xfr/fd_share.h
branches/trac299/src/lib/xfr/fdshare_python.cc
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 Oct 29 03:33:39 2010
@@ -77,7 +77,7 @@
MessageRenderer& response_renderer);
bool processAxfrQuery(const IOMessage& io_message, Message& message,
MessageRenderer& response_renderer);
- bool processNotify(const IOMessage& io_message, Message& message,
+ bool processNotify(const IOMessage& io_message, Message& message,
MessageRenderer& response_renderer);
std::string db_file_;
ModuleCCSession* config_session_;
@@ -307,7 +307,7 @@
ConstEDNSPtr remote_edns = message.getEDNS();
const bool dnssec_ok = remote_edns && remote_edns->getDNSSECAwareness();
const uint16_t remote_bufsize = remote_edns ? remote_edns->getUDPSize() :
- Message::DEFAULT_MAX_UDPSIZE;
+ Message::DEFAULT_MAX_UDPSIZE;
message.makeResponse();
message.setHeaderFlag(MessageFlag::AA());
@@ -377,7 +377,7 @@
xfrout_client_.disconnect();
xfrout_connected_ = false;
}
-
+
if (verbose_mode_) {
cerr << "[b10-auth] Error in handling XFR request: " << err.what()
<< endl;
@@ -391,8 +391,8 @@
}
bool
-AuthSrvImpl::processNotify(const IOMessage& io_message, Message& message,
- MessageRenderer& response_renderer)
+AuthSrvImpl::processNotify(const IOMessage& io_message, Message& message,
+ MessageRenderer& response_renderer)
{
// The incoming notify must contain exactly one question for SOA of the
// zone name.
@@ -434,7 +434,7 @@
}
return (false);
}
-
+
const string remote_ip_address =
io_message.getRemoteEndpoint().getAddress().toText();
static const string command_template_start =
@@ -445,7 +445,7 @@
try {
ConstElementPtr notify_command = Element::fromJSON(
- command_template_start + question->getName().toText() +
+ command_template_start + question->getName().toText() +
command_template_master + remote_ip_address +
command_template_rrclass + question->getClass().toText() +
command_template_end);
@@ -459,7 +459,7 @@
if (rcode != 0) {
if (verbose_mode_) {
cerr << "[b10-auth] failed to notify Zonemgr: "
- << parsed_answer->str() << endl;
+ << parsed_answer->str() << endl;
}
return (false);
}
Modified: branches/trac299/src/bin/xfrout/tests/xfrout_test.py
==============================================================================
--- branches/trac299/src/bin/xfrout/tests/xfrout_test.py (original)
+++ branches/trac299/src/bin/xfrout/tests/xfrout_test.py Fri Oct 29 03:33:39 2010
@@ -47,13 +47,13 @@
result = self.sendqueue[:size]
self.sendqueue = self.sendqueue[size:]
return result
-
+
def read_msg(self):
sent_data = self.readsent()
get_msg = Message(Message.PARSE)
get_msg.from_wire(bytes(sent_data[2:]))
return get_msg
-
+
def clear_send(self):
del self.sendqueue[:]
@@ -62,7 +62,7 @@
class MyXfroutSession(XfroutSession):
def handle(self):
pass
-
+
class Dbserver:
def __init__(self):
self._shutdown_event = threading.Event()
@@ -80,7 +80,8 @@
def setUp(self):
request = MySocket(socket.AF_INET,socket.SOCK_STREAM)
self.log = isc.log.NSLogger('xfrout', '', severity = 'critical', log_to_console = False )
- self.xfrsess = MyXfroutSession(request, None, None, self.log)
+ (self.mastsock, self.slavesock) = socket.socketpair()
+ self.xfrsess = MyXfroutSession(request, None, None, self.log, self.slavesock)
self.xfrsess.server = Dbserver()
self.mdata = bytes(b'\xd6=\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07example\x03com\x00\x00\xfc\x00\x01')
self.sock = MySocket(socket.AF_INET,socket.SOCK_STREAM)
@@ -93,7 +94,7 @@
def test_get_query_zone_name(self):
msg = self.getmsg()
self.assertEqual(self.xfrsess._get_query_zone_name(msg), "example.com.")
-
+
def test_send_data(self):
self.xfrsess._send_data(self.sock, self.mdata)
senddata = self.sock.readsent()
@@ -103,8 +104,8 @@
msg = self.getmsg()
self.xfrsess._reply_query_with_error_rcode(msg, self.sock, Rcode(3))
get_msg = self.sock.read_msg()
- self.assertEqual(get_msg.get_rcode().to_text(), "NXDOMAIN")
-
+ self.assertEqual(get_msg.get_rcode().to_text(), "NXDOMAIN")
+
def test_clear_message(self):
msg = self.getmsg()
qid = msg.get_qid()
@@ -118,7 +119,7 @@
self.assertTrue(msg.get_header_flag(MessageFlag.AA()))
def test_reply_query_with_format_error(self):
-
+
msg = self.getmsg()
self.xfrsess._reply_query_with_format_error(msg, self.sock)
get_msg = self.sock.read_msg()
@@ -217,7 +218,7 @@
sqlite3_ds.get_zone_soa = zone_soa
self.assertEqual(self.xfrsess._zone_exist(True), True)
self.assertEqual(self.xfrsess._zone_exist(False), False)
-
+
def test_check_xfrout_available(self):
def zone_exist(zone):
return zone
@@ -243,7 +244,7 @@
self.xfrsess.dns_xfrout_start(self.sock, b"\xd6=\x00\x00\x00\x01\x00")
sent_data = self.sock.readsent()
self.assertEqual(len(sent_data), 0)
-
+
def default(self, param):
return "example.com"
@@ -255,20 +256,20 @@
self.xfrsess.dns_xfrout_start(self.sock, self.mdata)
get_msg = self.sock.read_msg()
self.assertEqual(get_msg.get_rcode().to_text(), "NOTAUTH")
-
+
def test_dns_xfrout_start_noerror(self):
self.xfrsess._get_query_zone_name = self.default
def noerror(form):
- return Rcode.NOERROR()
+ return Rcode.NOERROR()
self.xfrsess._check_xfrout_available = noerror
-
+
def myreply(msg, sock, zonename):
self.sock.send(b"success")
-
+
self.xfrsess._reply_xfrout_query = myreply
self.xfrsess.dns_xfrout_start(self.sock, self.mdata)
self.assertEqual(self.sock.readsent(), b"success")
-
+
def test_reply_xfrout_query_noerror(self):
global sqlite3_ds
def get_zone_soa(zonename, file):
@@ -292,7 +293,7 @@
return "initdb.file", False
else:
return "unknown", False
-
+
class MyUnixSockServer(UnixSockServer):
def __init__(self):
@@ -306,7 +307,7 @@
class TestUnixSockServer(unittest.TestCase):
def setUp(self):
self.unix = MyUnixSockServer()
-
+
def test_updata_config_data(self):
self.unix.update_config_data({'transfers_out':10 })
self.assertEqual(self.unix._max_transfers_out, 10)
@@ -324,7 +325,7 @@
count = self.unix._transfers_counter
self.assertEqual(self.unix.increase_transfers_counter(), False)
self.assertEqual(count, self.unix._transfers_counter)
-
+
def test_decrease_transfers_counter(self):
count = self.unix._transfers_counter
self.unix.decrease_transfers_counter()
@@ -335,7 +336,7 @@
os.remove(sock_file)
except OSError:
pass
-
+
def test_sock_file_in_use_file_exist(self):
sock_file = 'temp.sock.file'
self._remove_file(sock_file)
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 Oct 29 03:33:39 2010
@@ -62,7 +62,6 @@
VERBOSE_MODE = False
-SESSION_RUNNABLE = False
XFROUT_MAX_MESSAGE_SIZE = 65535
def get_rrset_len(rrset):
@@ -82,8 +81,7 @@
def handle(self):
# Handle a request until shutdown or xfrout client is closed.
- global SESSION_RUNNABLE
- while SESSION_RUNNABLE:
+ while not self.server._shutdown_event.is_set(): # Check if xfrout is shutdown
try:
rlist, wlist, xlist = select.select([self._shutdown_sock, self.request], [], [])
except select.error as e:
@@ -96,14 +94,14 @@
continue
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.
- if fd == -2:
+ # xfrout running.
+ if fd == XFR_FD_REV_FAIL:
self._log.log_message("error", "Failed to receive the file descriptor for XFR connection")
- break
+ break
data_len = self.request.recv(2)
if not data_len:
@@ -122,16 +120,16 @@
try:
sock.shutdown(socket.SHUT_RDWR)
except socket.error:
- # Avoid socket error caused by shutting down
+ # 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]'''
- #TODO, need to add parseHeader() in case the message header is invalid
+ #TODO, need to add parseHeader() in case the message header is invalid
try:
msg = Message(Message.PARSE)
Message.from_wire(msg, mdata)
@@ -172,7 +170,7 @@
def _reply_query_with_format_error(self, msg, sock):
'''query message format isn't legal.'''
if not msg:
- return # query message is invalid. send nothing back.
+ return # query message is invalid. send nothing back.
msg.make_response()
msg.set_rcode(Rcode.FORMERR())
@@ -186,24 +184,24 @@
return True
def _zone_exist(self, zonename):
- # Find zone in datasource, should this works? maybe should ask
+ # Find zone in datasource, should this works? maybe should ask
# config manager.
soa = sqlite3_ds.get_zone_soa(zonename, self.server.get_db_file())
if soa:
return True
return False
-
+
def _check_xfrout_available(self, zone_name):
'''Check if xfr request can be responsed.
TODO, Get zone's configuration from cfgmgr or some other place
- eg. check allow_transfer setting,
+ eg. check allow_transfer setting,
'''
if not self._zone_exist(zone_name):
return Rcode.NOTAUTH()
if self._zone_is_empty(zone_name):
- return Rcode.SERVFAIL()
+ return Rcode.SERVFAIL()
#TODO, check allow_transfer
if not self.server.increase_transfers_counter():
@@ -233,14 +231,14 @@
self._log.log_message("error", str(err))
self.server.decrease_transfers_counter()
- return
+ return
def _clear_message(self, msg):
qid = msg.get_qid()
opcode = msg.get_opcode()
rcode = msg.get_rcode()
-
+
msg.clear(Message.RENDER)
msg.set_qid(qid)
msg.set_opcode(opcode)
@@ -250,7 +248,7 @@
return msg
def _create_rrset_from_db_record(self, record):
- '''Create one rrset from one record of datasource, if the schema of record is changed,
+ '''Create one rrset from one record of datasource, if the schema of record is changed,
This function should be updated first.
'''
rrtype_ = RRType(record[5])
@@ -258,7 +256,7 @@
rrset_ = RRset(Name(record[2]), RRClass("IN"), rrtype_, RRTTL( int(record[4])))
rrset_.add_rdata(rdata_)
return rrset_
-
+
def _send_message_with_last_soa(self, msg, sock, rrset_soa, message_upper_len):
'''Add the SOA record to the end of message. If it can't be
added, a new message should be created to send out the last soa .
@@ -326,18 +324,18 @@
self._log = log
self.update_config_data(config_data)
self._cc = cc
-
+
def finish_request(self, request, client_address):
'''Finish one request by instantiating RequestHandlerClass.'''
self.RequestHandlerClass(request, client_address, self, self._log, self._slave_sock)
def _remove_unused_sock_file(self, sock_file):
- '''Try to remove the socket file. If the file is being used
- by one running xfrout process, exit from python.
+ '''Try to remove the socket file. If the file is being used
+ by one running xfrout process, exit from python.
If it's not a socket file or nobody is listening
, it will be removed. If it can't be removed, exit from python. '''
if self._sock_file_in_use(sock_file):
- sys.stderr.write("[b10-xfrout] Fail to start xfrout process, unix socket"
+ sys.stderr.write("[b10-xfrout] Fail to start xfrout process, unix socket"
" file '%s' is being used by another xfrout process\n" % sock_file)
sys.exit(0)
else:
@@ -349,10 +347,10 @@
except OSError as err:
sys.stderr.write('[b10-xfrout] Fail to remove file %s: %s\n' % (sock_file, err))
sys.exit(0)
-
+
def _sock_file_in_use(self, sock_file):
- '''Check whether the socket file 'sock_file' exists and
- is being used by one running xfrout process. If it is,
+ '''Check whether the socket file 'sock_file' exists and
+ is being used by one running xfrout process. If it is,
return True, or else return False. '''
try:
sock = socket.socket(socket.AF_UNIX)
@@ -360,11 +358,9 @@
except socket.error as err:
return False
else:
- return True
+ return True
def shutdown(self):
- global SESSION_RUNNABLE
- SESSION_RUNNABLE = False
self._master_sock.send(b"shutdown") #terminate the xfrout session thread
ThreadingUnixStreamServer.shutdown(self)
try:
@@ -409,7 +405,7 @@
self._lock.release()
def listen_on_xfr_query(unix_socket_server):
- '''Listen xfr query in one single thread. Polls for shutdown
+ '''Listen xfr query in one single thread. Polls for shutdown
every 0.1 seconds, is there a better time?
'''
@@ -417,9 +413,9 @@
try:
unix_socket_server.serve_forever(poll_interval = 0.1)
except select.error as err:
- # serve_forever() calls select.select(), which can be
+ # serve_forever() calls select.select(), which can be
# interrupted.
- # If it is interrupted, it raises select.error with the
+ # If it is interrupted, it raises select.error with the
# errno set to EINTR. We ignore this case, and let the
# normal program flow continue by trying serve_forever()
# again.
@@ -432,7 +428,7 @@
def __init__(self):
self._unix_socket_server = None
self._log = None
- self._listen_sock_file = UNIX_SOCKET_FILE
+ self._listen_sock_file = UNIX_SOCKET_FILE
self._shutdown_event = threading.Event()
self._cc = isc.config.ModuleCCSession(SPECFILE_LOCATION, self.config_handler, self.command_handler)
self._config_data = self._cc.get_full_config()
@@ -446,12 +442,12 @@
def _start_xfr_query_listener(self):
'''Start a new thread to accept xfr query. '''
- self._unix_socket_server = UnixSockServer(self._listen_sock_file, XfroutSession,
+ self._unix_socket_server = UnixSockServer(self._listen_sock_file, XfroutSession,
self._shutdown_event, self._config_data,
self._cc, self._log);
listener = threading.Thread(target = listen_on_xfr_query, args = (self._unix_socket_server,))
listener.start()
-
+
def _start_notifier(self):
datasrc = self._unix_socket_server.get_db_file()
self._notifier = notify_out.NotifyOut(datasrc, self._log)
@@ -514,15 +510,13 @@
else:
answer = create_answer(1, "Bad command parameter:" + str(args))
- else:
+ else:
answer = create_answer(1, "Unknown command:" + str(cmd))
return answer
def run(self):
'''Get and process all commands sent from cfgmgr or other modules. '''
- global SESSION_RUNNABLE
- SESSION_RUNNABLE = True
while not self._shutdown_event.is_set():
self._cc.check_command(False)
@@ -558,7 +552,7 @@
sys.stderr.write("[b10-xfrout] Error creating xfrout, "
"is the command channel daemon running?\n")
except SessionTimeout as e:
- sys.stderr.write("[b10-xfrout] Error creating xfrout, "
+ sys.stderr.write("[b10-xfrout] Error creating xfrout, "
"is the configuration manager running?\n")
except ModuleCCSessionError as e:
sys.stderr.write("[b10-xfrout] exit xfrout process:%s\n" % str(e))
Modified: branches/trac299/src/bin/zonemgr/zonemgr.py.in
==============================================================================
--- branches/trac299/src/bin/zonemgr/zonemgr.py.in (original)
+++ branches/trac299/src/bin/zonemgr/zonemgr.py.in Fri Oct 29 03:33:39 2010
@@ -90,26 +90,26 @@
class ZonemgrRefresh:
"""This class will maintain and manage zone refresh info.
- It also provides methods to keep track of zone timers and
- do zone refresh.
- Zone timers can be started by calling run_timer(), and it
+ It also provides methods to keep track of zone timers and
+ do zone refresh.
+ Zone timers can be started by calling run_timer(), and it
can be stopped by calling shutdown() in another thread.
"""
def __init__(self, cc, db_file, slave_socket, config_data):
self._cc = cc
- self._check_sock = slave_socket
+ self._check_sock = slave_socket
self._db_file = db_file
self.update_config_data(config_data)
- self._zonemgr_refresh_info = {}
+ self._zonemgr_refresh_info = {}
self._build_zonemgr_refresh_info()
self._running = False
-
+
def _random_jitter(self, max, jitter):
"""Imposes some random jitters for refresh and
retry timers to avoid many zones need to do refresh
- at the same time.
+ at the same time.
The value should be between (max - jitter) and max.
"""
if 0 == jitter:
@@ -120,7 +120,7 @@
return time.time()
def _set_zone_timer(self, zone_name_class, max, jitter):
- """Set zone next refresh time.
+ """Set zone next refresh time.
jitter should not be bigger than half the original value."""
self._set_zone_next_refresh_time(zone_name_class, self._get_current_time() + \
self._random_jitter(max, jitter))
@@ -143,7 +143,7 @@
def _set_zone_notify_timer(self, zone_name_class):
"""Set zone next refresh time after receiving notify
- next_refresh_time = now
+ next_refresh_time = now
"""
self._set_zone_timer(zone_name_class, 0, 0)
@@ -199,7 +199,7 @@
raise ZonemgrException("[b10-zonemgr] zone (%s, %s) doesn't have soa." % zone_name_class)
zone_info["zone_soa_rdata"] = zone_soa[7]
zone_info["zone_state"] = ZONE_OK
- zone_info["last_refresh_time"] = self._get_current_time()
+ zone_info["last_refresh_time"] = self._get_current_time()
zone_info["next_refresh_time"] = self._get_current_time() + \
float(zone_soa[7].split(" ")[REFRESH_OFFSET])
self._zonemgr_refresh_info[zone_name_class] = zone_info
@@ -233,7 +233,7 @@
def _get_zone_notifier_master(self, zone_name_class):
if ("notify_master" in self._zonemgr_refresh_info[zone_name_class].keys()):
- return self._zonemgr_refresh_info[zone_name_class]["notify_master"]
+ return self._zonemgr_refresh_info[zone_name_class]["notify_master"]
return None
@@ -248,7 +248,7 @@
return self._zonemgr_refresh_info[zone_name_class]["zone_state"]
def _set_zone_state(self, zone_name_class, zone_state):
- self._zonemgr_refresh_info[zone_name_class]["zone_state"] = zone_state
+ self._zonemgr_refresh_info[zone_name_class]["zone_state"] = zone_state
def _get_zone_refresh_timeout(self, zone_name_class):
return self._zonemgr_refresh_info[zone_name_class]["refresh_timeout"]
@@ -268,7 +268,7 @@
try:
self._cc.group_sendmsg(msg, module_name)
except socket.error:
- sys.stderr.write("[b10-zonemgr] Failed to send to module %s, the session has been closed." % module_name)
+ sys.stderr.write("[b10-zonemgr] Failed to send to module %s, the session has been closed." % module_name)
def _find_need_do_refresh_zone(self):
"""Find the first zone need do refresh, if no zone need
@@ -281,10 +281,10 @@
if (ZONE_REFRESHING == zone_state and
(self._get_zone_refresh_timeout(zone_name_class) > self._get_current_time())):
continue
-
- # Get the zone with minimum next_refresh_time
- if ((zone_need_refresh is None) or
- (self._get_zone_next_refresh_time(zone_name_class) <
+
+ # Get the zone with minimum next_refresh_time
+ if ((zone_need_refresh is None) or
+ (self._get_zone_next_refresh_time(zone_name_class) <
self._get_zone_next_refresh_time(zone_need_refresh))):
zone_need_refresh = zone_name_class
@@ -292,14 +292,14 @@
if (self._get_zone_next_refresh_time(zone_need_refresh) < self._get_current_time()):
break
- return zone_need_refresh
-
-
+ return zone_need_refresh
+
+
def _do_refresh(self, zone_name_class):
"""Do zone refresh."""
log_msg("Do refresh for zone (%s, %s)." % zone_name_class)
self._set_zone_state(zone_name_class, ZONE_REFRESHING)
- self._set_zone_refresh_timeout(zone_name_class, self._get_current_time() + self._max_transfer_timeout)
+ self._set_zone_refresh_timeout(zone_name_class, self._get_current_time() + self._max_transfer_timeout)
notify_master = self._get_zone_notifier_master(zone_name_class)
# If the zone has notify master, send notify command to xfrin module
if notify_master:
@@ -307,7 +307,7 @@
"zone_class" : zone_name_class[1],
"master" : notify_master
}
- self._send_command(XFRIN_MODULE_NAME, ZONE_NOTIFY_COMMAND, param)
+ self._send_command(XFRIN_MODULE_NAME, ZONE_NOTIFY_COMMAND, param)
self._clear_zone_notifier_master(zone_name_class)
# Send refresh command to xfrin module
else:
@@ -328,19 +328,19 @@
while self._running:
# If zonemgr has no zone, set timer timeout to self._lowerbound_retry.
if self._zone_mgr_is_empty():
- timeout = self._lowerbound_retry
+ timeout = self._lowerbound_retry
else:
zone_need_refresh = self._find_need_do_refresh_zone()
# If don't get zone with minimum next refresh time, set timer timeout to self._lowerbound_retry.
if not zone_need_refresh:
- timeout = self._lowerbound_retry
+ timeout = self._lowerbound_retry
else:
timeout = self._get_zone_next_refresh_time(zone_need_refresh) - self._get_current_time()
if (timeout < 0):
self._do_refresh(zone_need_refresh)
continue
- """ Wait for the socket notification for a maximum time of timeout
+ """ Wait for the socket notification for a maximum time of timeout
in seconds (as float)."""
try:
rlist, wlist, xlist = select.select([self._check_sock, self._read_sock], [], [], timeout)
@@ -352,7 +352,7 @@
break
for fd in rlist:
- if fd == self._read_sock: # awaken by shutdown socket
+ if fd == self._read_sock: # awaken by shutdown socket
# self._running will be False by now, if it is not a false
# alarm
continue
@@ -416,7 +416,7 @@
self._zone_refresh = None
self._setup_session()
self._db_file = self.get_db_file()
- # Create socket pair for communicating between main thread and zonemgr timer thread
+ # Create socket pair for communicating between main thread and zonemgr timer thread
self._master_socket, self._slave_socket = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
self._zone_refresh = ZonemgrRefresh(self._cc, self._db_file, self._slave_socket, self._config_data)
self._zone_refresh.run_timer()
@@ -426,7 +426,7 @@
self.running = False
def _setup_session(self):
- """Setup two sessions for zonemgr, one(self._module_cc) is used for receiving
+ """Setup two sessions for zonemgr, one(self._module_cc) is used for receiving
commands and config data sent from other modules, another one (self._cc)
is used to send commands to proper modules."""
self._cc = isc.cc.Session()
@@ -438,7 +438,7 @@
# jitter should not be bigger than half of the original value
if self._config_data.get('jitter_scope') > 0.5:
self._config_data['jitter_scope'] = 0.5
- log_msg("[b10-zonemgr] jitter_scope should not be bigger than 0.5.")
+ log_msg("[b10-zonemgr] jitter_scope should not be bigger than 0.5.")
self._module_cc.start()
def get_db_file(self):
@@ -453,7 +453,7 @@
def shutdown(self):
"""Shutdown the zonemgr process. the thread which is keeping track of zone
timers should be terminated.
- """
+ """
self._zone_refresh.shutdown()
self._slave_socket.close()
@@ -472,7 +472,7 @@
if key == 'jitter_scope':
if new_config.get(key) > 0.5:
new_config[key] = 0.5
- log_msg("[b10-zonemgr] jitter_scope should not be bigger than 0.5.")
+ log_msg("[b10-zonemgr] jitter_scope should not be bigger than 0.5.")
self._config_data[key] = new_config[key]
if (self._zone_refresh):
@@ -501,7 +501,7 @@
def command_handler(self, command, args):
"""Handle command receivd from command channel.
- ZONE_NOTIFY_COMMAND is issued by Auth process; ZONE_XFRIN_SUCCESS_COMMAND
+ ZONE_NOTIFY_COMMAND is issued by Auth process; ZONE_XFRIN_SUCCESS_COMMAND
and ZONE_XFRIN_FAILED_COMMAND are issued by Xfrin process; shutdown is issued
by a user or Boss process. """
answer = create_answer(0)
@@ -570,10 +570,10 @@
except KeyboardInterrupt:
sys.stderr.write("[b10-zonemgr] exit zonemgr process\n")
except isc.cc.session.SessionError as e:
- sys.stderr.write("[b10-zonemgr] Error creating zonemgr, "
+ sys.stderr.write("[b10-zonemgr] Error creating zonemgr, "
"is the command channel daemon running?\n")
except isc.cc.session.SessionTimeout as e:
- sys.stderr.write("[b10-zonemgr] Error creating zonemgr, "
+ sys.stderr.write("[b10-zonemgr] Error creating zonemgr, "
"is the configuration manager running?\n")
except isc.config.ModuleCCSessionError as e:
sys.stderr.write("[b10-zonemgr] exit zonemgr process: %s\n" % str(e))
Modified: branches/trac299/src/lib/xfr/fd_share.cc
==============================================================================
--- branches/trac299/src/lib/xfr/fd_share.cc (original)
+++ branches/trac299/src/lib/xfr/fd_share.cc Fri Oct 29 03:33:39 2010
@@ -88,12 +88,12 @@
msghdr.msg_controllen = cmsg_space(sizeof(int));
msghdr.msg_control = malloc(msghdr.msg_controllen);
if (msghdr.msg_control == NULL) {
- return (-2);
+ return (XFR_FD_REV_FAIL);
}
if (recvmsg(sock, &msghdr, 0) < 0) {
free(msghdr.msg_control);
- return (-2);
+ return (XFR_FD_REV_FAIL);
}
const struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msghdr);
int fd = -1;
Modified: branches/trac299/src/lib/xfr/fd_share.h
==============================================================================
--- branches/trac299/src/lib/xfr/fd_share.h (original)
+++ branches/trac299/src/lib/xfr/fd_share.h Fri Oct 29 03:33:39 2010
@@ -20,6 +20,8 @@
namespace isc {
namespace xfr {
+const int XFR_FD_REV_FAIL = -2;
+
// Receive socket descriptor on unix domain socket 'sock'.
// Returned value is the socket descriptor received.
// Errors are indicated by a return value of -1.
Modified: branches/trac299/src/lib/xfr/fdshare_python.cc
==============================================================================
--- branches/trac299/src/lib/xfr/fdshare_python.cc (original)
+++ branches/trac299/src/lib/xfr/fdshare_python.cc Fri Oct 29 03:33:39 2010
@@ -21,6 +21,8 @@
#include <config.h>
#include <xfr/fd_share.h>
+
+static PyObject *XFR_FD_REV_FAIL;
static PyObject*
fdshare_recv_fd(PyObject *self UNUSED_PARAM, PyObject *args) {
@@ -68,6 +70,9 @@
return (NULL);
}
+ XFR_FD_REV_FAIL = Py_BuildValue("i", isc::xfr::XFR_FD_REV_FAIL);
+ PyModule_AddObject(mod, "XFR_FD_REV_FAIL", XFR_FD_REV_FAIL);
+
return (mod);
}
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 Oct 29 03:33:39 2010
@@ -69,7 +69,7 @@
}
}
-int
+int
XfroutClient::sendXfroutRequestInfo(const int tcp_sock,
const void* const msg_data,
const uint16_t msg_len)
@@ -93,7 +93,7 @@
isc_throw(XfroutError,
"failed to send XFR request data to xfrout module");
}
-
+
return (0);
}
More information about the bind10-changes
mailing list