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

Kazunori Fujiwara fujiwara at wide.ad.jp
Tue Jun 15 14:09:49 UTC 2010


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.

I think there are another solutions. 
One is to expand the ModuleCCSession class.
The other is to use threads.
Another is to open two sessions.

I prefer select/poll/kqueue model and minimal number of sockets.

Regards,

--
Kazunori Fujiwara



More information about the bind10-dev mailing list