BIND 10 trac1542, updated. 49752533bcb8680e8633161230b89e990efcee58 Merge branch 'trac1542' of git+ssh://git.bind10.isc.org/var/bind10/git/bind10 into work/sockerror
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Jan 27 12:57:09 UTC 2012
The branch, trac1542 has been updated
via 49752533bcb8680e8633161230b89e990efcee58 (commit)
via c911317eb2d13c3221b468be0f21118dba140d19 (commit)
via b93b50507fc8e49e5f9e204f86f1f06d059abcb0 (commit)
via 59902e100c9a9249d633fd084f9d31e42c4a62d5 (commit)
via cd78ecd9fb6d0c59abe3ffab4418add6a7f1173f (commit)
from f635adf0a3eb754afc8bd171d8a7a274db5e31c8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 49752533bcb8680e8633161230b89e990efcee58
Merge: c911317eb2d13c3221b468be0f21118dba140d19 f635adf0a3eb754afc8bd171d8a7a274db5e31c8
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Jan 27 13:56:52 2012 +0100
Merge branch 'trac1542' of git+ssh://git.bind10.isc.org/var/bind10/git/bind10 into work/sockerror
commit c911317eb2d13c3221b468be0f21118dba140d19
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Jan 27 13:47:11 2012 +0100
[1542] Constants when receiving rcodes
commit b93b50507fc8e49e5f9e204f86f1f06d059abcb0
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Jan 27 13:46:54 2012 +0100
[1542] Constants when sending rcodes
commit 59902e100c9a9249d633fd084f9d31e42c4a62d5
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Jan 27 13:38:31 2012 +0100
[1542] Docs clarification
commit cd78ecd9fb6d0c59abe3ffab4418add6a7f1173f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Jan 27 13:36:36 2012 +0100
[1542] Fix check_code
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/bind10_src.py.in | 10 ++++++++--
src/bin/bind10/tests/bind10_test.py.in | 3 ++-
src/lib/server_common/socket_request.cc | 8 ++++++--
src/lib/server_common/socket_request.h | 5 +++--
4 files changed, 19 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index 35ef680..a09677e 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -87,6 +87,10 @@ DBG_COMMANDS = logger.DBGLVL_TRACE_DETAIL
CREATOR_SOCKET_OK = b"1\n"
CREATOR_SOCKET_UNAVAILABLE = b"0\n"
+# RCodes of known exceptions for the get_token command
+CREATOR_SOCKET_ERROR = 2
+CREATOR_SHARE_ERROR = 3
+
# Assign this process some longer name
isc.util.process.rename(sys.argv[0])
@@ -806,9 +810,11 @@ class BoB:
'path': self._socket_path
})
except isc.bind10.socket_cache.SocketError as e:
- return isc.config.ccsession.create_answer(2, str(e))
+ return isc.config.ccsession.create_answer(CREATOR_SOCKET_ERROR,
+ str(e))
except isc.bind10.socket_cache.ShareError as e:
- return isc.config.ccsession.create_answer(3, str(e))
+ return isc.config.ccsession.create_answer(CREATOR_SHARE_ERROR,
+ str(e))
except Exception as e:
return isc.config.ccsession.create_answer(1, str(e))
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 4771cad..018a3b9 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -263,10 +263,11 @@ class TestCacheCommands(unittest.TestCase):
"""
[rcode, ranswer] = self.__boss._get_socket(args)['result']
self.assertEqual(code, rcode)
- if code == 1:
+ if code != 0:
# This should be an error message. The exact formatting
# is unknown, but we check it is string at least
self.assertTrue(isinstance(ranswer, str))
+
def mod_args(name, value):
"""
Override a parameter in the args.
diff --git a/src/lib/server_common/socket_request.cc b/src/lib/server_common/socket_request.cc
index bc4b984..546de05 100644
--- a/src/lib/server_common/socket_request.cc
+++ b/src/lib/server_common/socket_request.cc
@@ -64,6 +64,10 @@ const std::string& RELEASE_SOCKET_COMMAND() {
return (str);
}
+// RCode constants for the get_token command
+const size_t SOCKET_ERROR_CODE = 2;
+const size_t SHARE_ERROR_CODE = 3;
+
// A helper converter from numeric protocol ID to the corresponding string.
// used both for generating a message for the boss process and for logging.
inline const char*
@@ -134,10 +138,10 @@ readRequestSocketAnswer(isc::data::ConstElementPtr recv_msg,
isc::data::ConstElementPtr answer = isc::config::parseAnswer(rcode,
recv_msg);
// Translate known rcodes to the corresponding exceptions
- if (rcode == 2) {
+ if (rcode == SOCKET_ERROR_CODE) {
isc_throw(SocketRequestor::SocketAllocateError, answer->str());
}
- if (rcode == 3) {
+ if (rcode == SHARE_ERROR_CODE) {
isc_throw(SocketRequestor::ShareError, answer->str());
}
// The unknown exceptions
diff --git a/src/lib/server_common/socket_request.h b/src/lib/server_common/socket_request.h
index 6a1c8f3..5708cc1 100644
--- a/src/lib/server_common/socket_request.h
+++ b/src/lib/server_common/socket_request.h
@@ -110,7 +110,8 @@ public:
/// This is thrown if the requested socket can't be granted, but it is only
/// that one socket, not that the system would be broken or anything. This
/// exception is a common base class for the concrete exceptions actually
- /// thrown.
+ /// thrown. You can safely keep using the SocketRequestor after this
+ /// exception (or anything derived from it) is thrown.
///
/// \see ShareError
/// \see SocketAllocateError
@@ -135,7 +136,7 @@ public:
{ }
};
- /// \brief Exception when the operation system doesn't allow us to create
+ /// \brief Exception when the operating system doesn't allow us to create
/// the requested socket.
///
/// This happens when the socket() or bind() call fails in the socket
More information about the bind10-changes
mailing list