From: Hemang L. <hl...@ci...> - 2006-08-12 03:54:10
|
Andreas Kupries wrote: > > I am still not convinced. Maybe we have simply too different visions for what we > want to do with this. > > When I wrote these commands I wanted to have convenient setup functionality > specifically for and only for the eval hook. The other hooks simply did not > enter the picture, they were out of scope. To put them into scope I need a very > clear picture/vision on how they are used in such a situation. I have one server process and several client processes which are connected via comm channels. The server process is the master which hands off commands to execute on the client processes and keeps track of their execution progress in a global array. Each client is identified by a unique name and periodically sends signals to the server process to indicate its status. Sometimes a client process may get terminated either gracefully or abnormally say via kill command invoked by the user. The master process will know about it via "lost connection" hook and will perform cleanup. For debugging purposes, I use tcllib's logger package in the eval hook -- ${log}::debug API to print the name of the client, the status of global array for the corresponding client and the commands it has received over the comm channel. See below: # Setup event handler to do a cleanup whenever any socket # connection to the client process is lost. ::comm::comm hook lost "::foo::_cleanup \$id [list $client_id]" # Log all commands before evaluating them ::comm::comm hook eval {::foo::log::debug "Cmd eval: $buffer id: $client_id\n\[parray data($client_id)]"} # Log all command replies before evaluating them ::comm::comm hook reply {::foo::log::debug "Cmd reply: $buffer id: $client_id\n\[parray data($client_id)]"} With your proposal for comm/interp enhancements, I can use it to restrict the commands executed by the clients in the master process. I hope you get the idea. Hemang. |