[Klone-users] Multithreading
thomas fossati
tho at koanlogic.com
Mon Mar 17 05:04:50 EDT 2008
Hi,
On Mar 17, 2008, at 9:07 AM, diakat 2000 wrote:
> Hello,
>
> I've a question again.
>
> Is it possible to use KLone as a webserver, who's listen on two ports
> simultaneous.
yes, you can have multiple backends listed in 'server_list', each one
with its own configuration record.
Your kloned.conf could be something like:
server_list main ctrl
main.addr.port 80
ctrl.addr.port 8080
...
ctrl could also be an HTTPS server if needed, i.e.:
ctrl.type https
...
[ see klone-core-2.x.y/etc/kloned-https.conf for more details. ]
> If there are new Data on one port, I have to reload the current
> website (send data on the other port).
>
> I think, I have to start two threads - but how could they communicate
> with each other, in that way, that the current website could be
> reloaded automatically?
probably the cleanest solution would be to terminate the parent kloned
and let a shell wrapper restart it automatically (a la daemontools):
So, tell ctrl that we need to restart:
https://localhost:8080/ctrl.kl1?action=restart
Then in ctrl.kl1 (pseudo-code):
if (action == restart)
{
kill(getpid(), SIGINT);
/* or getppid() depending on server 'model' */
}
And finally in the shell wrapper:
while true
do
kloned -F -...
done
Hope it helps.
ciao, t.
More information about the klone-users
mailing list