BIND 10 trac1522, updated. 199ebdc9c9db2f7744bfc50f0b13eec40eeed5ed [1522] added some logging messages for the socket requestor.
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Dec 30 09:09:17 UTC 2011
The branch, trac1522 has been updated
via 199ebdc9c9db2f7744bfc50f0b13eec40eeed5ed (commit)
from d38b9068dde3191aef574fdda44f381f528b8146 (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 199ebdc9c9db2f7744bfc50f0b13eec40eeed5ed
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Fri Dec 30 01:09:01 2011 -0800
[1522] added some logging messages for the socket requestor.
-----------------------------------------------------------------------
Summary of changes:
src/lib/server_common/server_common_messages.mes | 25 ++++++++++++++++++++++
src/lib/server_common/socket_request.cc | 22 +++++++++++++++++++
2 files changed, 47 insertions(+), 0 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/server_common/server_common_messages.mes b/src/lib/server_common/server_common_messages.mes
index 5fbbb0b..ababa08 100644
--- a/src/lib/server_common/server_common_messages.mes
+++ b/src/lib/server_common/server_common_messages.mes
@@ -71,3 +71,28 @@ specification is outside the valid range of 0 to 65535.
% SRVCOMM_SET_LISTEN setting addresses to listen to
Debug message, noting that the server is about to start listening on a
different set of IP addresses and ports than before.
+
+% SOCKETREQUESTOR_CREATED Socket requestor created
+Debug message. A socket requesor (client of the socket creator) is created
+for the corresponding application. Normally this should happen at most
+one time throughout the lifetime of the application.
+
+% SOCKETREQUESTOR_DESTROYED Socket requestor destoryed
+Debug message. The socket requestor created at SOCKETREQUESTOR_CREATED
+has been destroyed. This event is generally unexpected other than in
+test cases.
+
+% SOCKETREQUESTOR_GETSOCKET Received a %1 socket for [%2]:%3, FD=%4, token=%5, path=%6
+Debug message. The socket requestor for the corresponding application
+has requested a socket for a set of address, port and protocol (shown
+in the log message) and successfully got it from the creator. The
+corresponding file descriptor and the associated "token" (an internal
+ID used between the creator and requestor) are shown in the log
+message.
+
+% SOCKETREQUESTOR_RELEASESOCKET Released a socket of token %1
+Debug message. The socket requestor has released a socket passed by
+the creator. The associated token of the socket is shown in the
+log message. If the corresponding SOCKETREQUESTOR_GETSOCKET was logged
+more detailed information of the socket can be identified by matching
+the token.
diff --git a/src/lib/server_common/socket_request.cc b/src/lib/server_common/socket_request.cc
index 8f85334..cdbcf3b 100644
--- a/src/lib/server_common/socket_request.cc
+++ b/src/lib/server_common/socket_request.cc
@@ -14,6 +14,7 @@
#include <config.h>
#include "socket_request.h"
+#include <server_common/logger.h>
#include <config/ccsession.h>
#include <cc/data.h>
@@ -230,6 +231,20 @@ getSocketFd(const std::string& token, int sock_pass_fd) {
return (passed_sock_fd);
}
+namespace {
+inline const char*
+protocolString(SocketRequestor::Protocol protocol) {
+ switch (protocol) {
+ case SocketRequestor::TCP:
+ return ("TCP");
+ case SocketRequestor::UDP:
+ return ("UDP");
+ default:
+ return ("unknown protocol");
+ }
+}
+}
+
// This implementation class for SocketRequestor uses
// a ModuleCCSession for communication with the boss process,
// and fd_share to read out the socket(s).
@@ -251,10 +266,12 @@ public:
isc_throw(Unexpected, "Failed to filter SIGPIPE: " <<
strerror(errno));
}
+ LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, SOCKETREQUESTOR_CREATED);
}
~SocketRequestorCCSession() {
closeFdShareSockets();
+ LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, SOCKETREQUESTOR_DESTROYED);
}
virtual SocketID requestSocket(Protocol protocol,
@@ -286,6 +303,9 @@ public:
// and finally get the socket itself
const int passed_sock_fd = getSocketFd(token, sock_pass_fd);
+ LOG_DEBUG(logger, DBGLVL_TRACE_DETAIL, SOCKETREQUESTOR_GETSOCKET).
+ arg(protocolString(protocol)).arg(address).arg(port).
+ arg(passed_sock_fd).arg(token).arg(path);
return (SocketID(passed_sock_fd, token));
}
@@ -295,6 +315,8 @@ public:
// Send it to boss
const int seq = session_.groupSendMsg(release_msg, "Boss");
+ LOG_DEBUG(logger, DBGLVL_TRACE_DETAIL, SOCKETREQUESTOR_RELEASESOCKET).
+ arg(token);
// Get the answer from the boss.
// Just do a blocking read, we can't really do much anyway
More information about the bind10-changes
mailing list