Permalink
Browse files

MAJOR update:

- split the application in two part: a single controller (tsunami_controller),
and the clients (tsunami)
- add preliminary http support
- add https support (to be tested)

TODO: update the docs and comments

SVN Revision: 26
  • Loading branch information...
1 parent 1a509bc commit 93f6babaa1ce1a06eb67050daf34e1fc3cbb8fcf @nniclausse nniclausse committed Feb 3, 2003
View
@@ -9,13 +9,18 @@ PA = -pa ./ebin -pa ./src -pa . -pa ./system -pa ../ebin -pa .. -pa ../system -p
prefix = /usr/local/idx-tsunami
+# export ERLC_EMULATOR to fix a bug in R9B with native compilation
+ERLC_EMULATOR=/usr/local/bin/erl
+export ERLC_EMULATOR
DEBUGINFO:=+debug_info
+#OPTIONS:=+native +\{hipe,\[o3\]\}
+ERLC = erlc $(OPTIONS)
ERLC = erlc $(DEBUGINFO)
OUTDIR = ebin
ALLERLS:= $(wildcard src/*.erl)
ALLBEAMS:=$(patsubst src/%.erl,$(OUTDIR)/%.beam, $(ALLERLS))
-all: tsunami.boot
+all: tsunami.boot tsunami_controller.boot
show:
@echo "sources: $(ALLERLS)"
@@ -32,7 +37,7 @@ tarball:
clean:
- rm -f $(ALLBEAMS) tsunami.boot tsunami.script ebin/tsunami.app ebin/tsunami.rel ebin/idx-tsunami.pl ebin/analyse_msg.pl
+ rm -f $(ALLBEAMS) tsunami.boot tsunami.script ebin/tsunami*.app ebin/tsunami*.rel ebin/idx-tsunami.pl ebin/analyse_msg.pl
tsunami.boot: ebin $(ALLBEAMS) $(UTILS) src/tsunami.rel.src src/tsunami.app.src src/analyse_msg.pl.src src/idx-tsunami.pl.src
sed -e 's;%VSN%;$(VSN);' ./src/tsunami.app.src > ./ebin/tsunami.app
@@ -41,6 +46,11 @@ tsunami.boot: ebin $(ALLBEAMS) $(UTILS) src/tsunami.rel.src src/tsunami.app.src
sed -e 's;%VSN%;$(VSN);' ./src/analyse_msg.pl.src > ./ebin/analyse_msg.pl
erl -noshell $(PA) ./src -s make_boot make_boot tsunami
+tsunami_controller.boot: ebin $(ALLBEAMS) $(UTILS) src/tsunami_controller.rel.src src/tsunami_controller.app.src
+ sed -e 's;%VSN%;$(VSN);' ./src/tsunami_controller.app.src > ./ebin/tsunami_controller.app
+ sed -e 's;%VSN%;$(VSN);' ./src/tsunami_controller.rel.src > ./ebin/tsunami_controller.rel
+ erl -noshell $(PA) ./src -s make_boot make_boot tsunami_controller
+
ebin:
mkdir ebin
@@ -50,13 +60,14 @@ $(OUTDIR)/%.beam: ebin/%.erl
$(OUTDIR)/%.beam: src/%.erl include/*.hrl
$(ERLC) -o $(OUTDIR) $<
-install: tsunami.boot
+install: tsunami.boot tsunami_controller.boot
mkdir -p $(DESTDIR)/$(prefix)
mkdir -p $(DESTDIR)/$(prefix)/bin
mkdir -p $(DESTDIR)/$(prefix)/log
mkdir -p $(DESTDIR)/$(prefix)/etc
mkdir -p $(DESTDIR)/$(prefix)/bin
install -m 0644 tsunami.boot $(DESTDIR)/$(prefix)/bin
+ install -m 0644 tsunami_controller.boot $(DESTDIR)/$(prefix)/bin
install -m 0644 idx-tsunamirc $(DESTDIR)/$(prefix)/etc/idx-tsunamirc.default
install ebin/idx-tsunami.pl $(DESTDIR)/${prefix}/bin
install ebin/analyse_msg.pl $(DESTDIR)/${prefix}/bin
View
@@ -0,0 +1,42 @@
+%%% This code was developped by IDEALX (http://IDEALX.org/) and
+%%% contributors (their names can be found in the CONTRIBUTORS file).
+%%% Copyright (C) 2000-2001 IDEALX
+%%%
+%%% This program is free software; you can redistribute it and/or modify
+%%% it under the terms of the GNU General Public License as published by
+%%% the Free Software Foundation; either version 2 of the License, or
+%%% (at your option) any later version.
+%%%
+%%% This program is distributed in the hope that it will be useful,
+%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%%% GNU General Public License for more details.
+%%%
+%%% You should have received a copy of the GNU General Public License
+%%% along with this program; if not, write to the Free Software
+%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+%%%
+
+-vc('$Id$ ').
+-author('nicolas.niclausse@IDEALX.com').
+
+%% use by the client to create the request
+-record(http_request, {url, cookie=none, method=get, body=[], id = 0 }).
+
+%% use by the client process to store information about the current request during
+%% the parsing of the response
+-record(http, {content_length= 0, % HTTP header: content length
+ body_size = 0, % current size of body,
+ status = none % HTTP resp. status :200, etc. 'none' if no current cnx.
+ }).
+
+-define(server_name, ts_utils:get_val(server_name)).
+-define(http_req_filename, ts_utils:get_val(http_req_filename)).
+-define(http_version, ts_utils:get_val(http_version)).
+
+%% HTTP Protocol
+-define(GET, "GET").
+-define(POST, "POST").
+-define(HTTP10, "HTTP/1.0").
+-define(HTTP11, "HTTP/1.1").
+
@@ -20,16 +20,22 @@
-vc('$Id$ ').
-author('nicolas.niclausse@IDEALX.com').
--record(message, {thinktime, ack, param, type=static}).
+-record(message, {thinktime,
+ ack,
+ param,
+ type=static,
+ endpage=false
+ }).
% state of ts_client_rcv gen_server
-record(state_rcv,
{socket, % unused ?
timeout, % ?
ack, % type of ack: no_ack, local, global or parse
- parsetype, % obsolete ?
ack_done=false, % 'true' if the ack was sent, else 'false' (unused if ack=no_ack)
ack_timestamp, % date when the 'request' was sent
+ page_timestamp=0, % date when the first 'request' of a page was sent
+ endpage=false, % if true, a page is ending
session, % record of session status; depends on 'clienttype'
datasize=0,
ppid, % pid of send process
@@ -43,6 +49,7 @@
%% retry sending message after this timeout (in microsec.)
-define(client_retry_timeout, ts_utils:get_val(client_retry_timeout)).
+-define(req_server_timeout, ts_utils:get_val(req_server_timeout)). %% timeout when for reading the session file
-define(restart_try, 3).
-define(debug_level, ts_utils:get_val(debug_level)).
@@ -70,6 +77,7 @@
-define(log_file, ts_utils:get_val(log_file)).
-define(monitoring, ts_utils:get_val(monitoring)).
-define(monitor_timeout, ts_utils:get_val(monitor_timeout)).
+-define(dumpstats_interval, ts_utils:get_val(dumpstats_interval)).
-define(clients_timeout, ts_utils:get_val(clients_timeout)).
-define(server_adr, ts_utils:get_val(server_adr)).
@@ -29,7 +29,7 @@ use POSIX;
use Getopt::Long;
use vars qw /$help $start $config $stop $version/;
-my $erl = "/usr/bin/erl";
+my $erl = "erl";
my $ssh = "ssh -x";
my $scp = "scp ";
my %config;
@@ -87,7 +87,9 @@ if ($config or $start) {
$appfile = "$rootdir/etc/tsunami$i.config";
open (APP,">$appfile") or die("Impossible d'ouvrir le fichier $appfile");
select APP;
- print "[{tsunami,
+ print "[";
+ foreach my $appname ("tsunami_controller", "tsunami") {
+ print "{$appname,
[\n";
foreach $key (sort keys %config) {
if ($key eq "server_adr") {
@@ -115,9 +117,11 @@ if ($config or $start) {
} else {
print "{mes_type, static}\n";
}
- print " ]
- }].\n";
+ print " ] }\n";
+ print " ,\n" if $appname ne "tsunami";
+ }
+ print "].\n";
close APP ;
select STDOUT;
if ($start and not $config) {
@@ -137,7 +141,11 @@ if ($config or $start) {
}
}
$j += $nbeams;
+ sleep (1);
}
+ print "$erl -sname controller -setcookie \'$config{'cookie'}\' -detached -boot $rootdir/bin/tsunami_controller -boot_var TSUNAMIPATH $rootdir/erlang -config $rootdir/etc/tsunami0\.config\n" ;#and die "system failed: $?" ;
+ system("$erl -sname controller -setcookie \'$config{'cookie'}\' -detached -boot $rootdir/bin/tsunami_controller -boot_var TSUNAMIPATH $rootdir/erlang -config $rootdir/etc/tsunami0\.config" ) ;#and die "system failed: $?" ;
+
} elsif ($stop) {
&read_rc;
&stop;
Oops, something went wrong.

0 comments on commit 93f6bab

Please sign in to comment.