From a0bdc8bbd4d346939e7c24fd7e07b6d361d78643 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 6 Jul 1999 12:17:15 +0000 Subject: [PATCH] Added option -1 that runs server once (for profiling purposes). --- include/statserv.h | 6 +++++- server/seshigh.c | 7 ++++++- server/statserv.c | 12 ++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/statserv.h b/include/statserv.h index f27442a..7298ef7 100644 --- a/include/statserv.h +++ b/include/statserv.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: statserv.h,v $ - * Revision 1.16 1999-06-10 11:45:30 adam + * Revision 1.17 1999-07-06 12:17:15 adam + * Added option -1 that runs server once (for profiling purposes). + * + * Revision 1.16 1999/06/10 11:45:30 adam * Added bend_start, bend_stop handlers and removed pre_init. * Handlers bend_start/bend_stop are called when service/daemon is * started/stopped. @@ -99,6 +102,7 @@ extern "C" { typedef struct statserv_options_block { int dynamic; /* fork on incoming requests */ + int one_shot; /* one session then exit(1) */ int loglevel; /* desired logging-level */ char apdufile[ODR_MAXNAME+1]; /* file for pretty-printed PDUs */ char logfile[ODR_MAXNAME+1]; /* file for diagnostic output */ diff --git a/server/seshigh.c b/server/seshigh.c index 33c7b06..e89e830 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.92 1999-06-17 10:54:45 adam + * Revision 1.93 1999-07-06 12:17:15 adam + * Added option -1 that runs server once (for profiling purposes). + * + * Revision 1.92 1999/06/17 10:54:45 adam * Added facility to specify implementation version - and name * for server. * @@ -451,6 +454,8 @@ void destroy_association(association *h) request_delq(&h->incoming); request_delq(&h->outgoing); xfree(h); + if (control_block && control_block->one_shot) + exit (0); } static void do_close_req(association *a, int reason, char *message, diff --git a/server/statserv.c b/server/statserv.c index e079866..9305cdf 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -7,7 +7,10 @@ * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: statserv.c,v $ - * Revision 1.56 1999-06-10 11:45:30 adam + * Revision 1.57 1999-07-06 12:17:15 adam + * Added option -1 that runs server once (for profiling purposes). + * + * Revision 1.56 1999/06/10 11:45:30 adam * Added bend_start, bend_stop handlers and removed pre_init. * Handlers bend_start/bend_stop are called when service/daemon is * started/stopped. @@ -233,6 +236,7 @@ static char *me = "statserver"; int check_options(int argc, char **argv); statserv_options_block control_block = { 1, /* dynamic mode */ + 0, /* one shot (single session) */ LOG_DEFAULT_LEVEL, /* log level */ "", /* no PDUs */ "", /* diagnostic output to stderr */ @@ -858,13 +862,17 @@ int check_options(int argc, char **argv) int ret = 0, r; char *arg; - while ((ret = options("a:iszSl:v:u:c:w:t:k:d:", argv, argc, &arg)) != -2) + while ((ret = options("1a:iszSl:v:u:c:w:t:k:d:", argv, argc, &arg)) != -2) { switch (ret) { case 0: add_listener(arg, control_block.default_proto); break; + case '1': + control_block.one_shot = 1; + control_block.dynamic = 0; + break; case 'z': control_block.default_proto = PROTO_Z3950; break; -- 1.7.10.4