[bind10-dev] Question about config channel and another msgq channel

Jelte Jansen jelte at isc.org
Wed Jun 16 08:02:00 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
> ModuleCCSession.
> 
> 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()
>   cc.subscribe_group("stat_group")
>   config = ModuleCCSession(SPECFILE, config_handler, command_handler, cc_session = cc)
>   config.start()
>   # 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
that.

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)

Jelte
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwYhPgACgkQ4nZCKsdOncW+OwCffZQxBJOeOsEnRSZ3eUCBmKWm
VZ0AmwT2Uj0mseOhAvAojZRNcdJ0dYbx
=gRkW
-----END PGP SIGNATURE-----



More information about the bind10-dev mailing list