[bind10-dev] Question about config channel and another msgq channel
jelte at isc.org
Wed Jun 16 08:02:00 UTC 2010
-----BEGIN PGP SIGNED MESSAGE-----
On 06/15/2010 04:09 PM, Kazunori Fujiwara wrote:
> The statistics collecting program need to join two msgq channel.
> One is the statistics channel which statistics clients send data to.
> The other is the config channel via isc.config.ModuleCCSession.__init__().
> Both channel may be shared because ModuleCCSession.__init__() accepts
> cc_session parameter. Main program opens Session() and can pass it to
> But in main loop, ModuleCCSession's check_command() method blocks and
> read all messages from the session.
> How do I use check_command() method ?
> I like to use this logic like:
> cc = Session()
> config = ModuleCCSession(SPECFILE, config_handler, command_handler, cc_session = cc)
> # initialization
> while true:
> # prepare select
> r,w,e = select.select([cc._socket], , , wait)
> for sock in r:
> if sock == cc._socket:
> data,envelope = cc.group_recvmsg(False)
> # parse envelope
> if the envelope and data is for config, DO config
> if the envelope and data is for statistics, DO statistics
> But current ModuleCCsession class does not have such function.
perhaps we should simply make the blocking call nonblocking (or make it
optional), i think the rest of the code in check_command is already prepared for
Furthermore, perhaps i'm not understanding your question here, but I think you
could simply call check_command in this code where you now do group_recvmsg(),
and determine what type (config/stats) it is in the callback you provide, or is
that not possible?
(check_command blocks but with select you already found there is data, though
one should also put hasQueuedMsgs() in this loop then, before the select(), and
handle those if there are any)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the bind10-dev