Browse Source

copyed from experiments/fujiwara-stats/src/lib/python/isc/config/ccsession.py
and added comments from jelte's comment.


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac292@2968 e5f2f494-b856-4b98-b285-d166d9295462

Kazunori Fujiwara 14 years ago
parent
commit
c321557533
1 changed files with 12 additions and 5 deletions
  1. 12 5
      src/lib/python/isc/config/ccsession.py

+ 12 - 5
src/lib/python/isc/config/ccsession.py

@@ -174,11 +174,18 @@ class ModuleCCSession(ConfigData):
         """Close the session to the command channel"""
         self._session.close()
 
-    def check_command(self):
-        """Check whether there is a command or configuration update
-           on the channel. Call the corresponding callback function if
-           there is."""
-        msg, env = self._session.group_recvmsg(False)
+    def check_command(self, nonblock = False):
+        """Check whether there is a command or configuration update on
+           the channel. Calls check_command_without_recvmsg() to parse
+           the received message."""
+        msg, env = self._session.group_recvmsg(nonblock)
+        self.check_command_without_recvmsg(msg, env)
+
+    def check_command_without_recvmsg(self, msg, env):
+        """Parse the given message to see if there is a command or a
+           configuration update. Calls the corresponding handler
+           functions if present. Responds on the channel if the
+           handler returns a message.""" 
         # should we default to an answer? success-by-default? unhandled error?
         if msg and not 'result' in msg:
             answer = None