[Unbound-users] why unbound distinguish between the command type & command string

lin totopper at qq.com
Thu Jan 15 07:52:06 UTC 2015


I read the unbound remote control code, I  know that unbound use pipe in the remote control logic.However, I am confused, I summary the steps as follows.
Firstly,Unbound add pipe read side into I/O event list,so if the pipe has data, the select (epoll_wait) function return, andexecute the callback function.
Secondly,unbound receive user command,such as unbound-control stub_add ***,and then the main thread first write the command type such as "worker_cmd_remote" into all pipe write side via function worker_send_cmd,and then call functiontube_write_msg write the command string to the pipe.
Thirdly,because pipe has data to read,so the event callback function would be executed,and read the command type such as "worker_cmd_remote" from the pipe, and then call function tube_read_msg to read the command string,and then call function execute_cmd to exucte the command.


So  my question is that why unbound distinguish between the command type & command string,I think we can send the command string to the child thread directly,and do not need send the command type firstly.‍



------------------
Best wishes for youFrom Sure Ning
Mail:isyes at foxmail.com
Address:Beijing China(中国 北京)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/unbound-users/attachments/20150115/b730cb32/attachment.htm>


More information about the Unbound-users mailing list