X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=server%2Fstatserv.c;h=03713d472dbf64ea3335283316f121ddc2b99528;hb=524bfef7eb43a79c16beacccedf6d047074372b5;hp=cecc6b1a969f2485f99d9074ede9c254dbf03edb;hpb=bc66c2a11aa31c16f46c49100e99dc9b7e940faf;p=yaz-moved-to-github.git diff --git a/server/statserv.c b/server/statserv.c index cecc6b1..03713d4 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 1995-2001, Index Data + * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * - * NT server based on threads by + * NT threaded server code by * Chas Woodfield, Fretwell Downing Informatics. * - * $Id: statserv.c,v 1.78 2001-10-24 12:24:43 adam Exp $ + * $Id: statserv.c,v 1.83 2002-08-17 07:56:59 adam Exp $ */ #include @@ -243,7 +243,7 @@ void statserv_closedown() } } -void event_loop_thread (IOCHAN iochan) +void __cdecl event_loop_thread (IOCHAN iochan) { event_loop (&iochan); } @@ -601,7 +601,7 @@ static void inetd_connection(int what) /* * Set up a listening endpoint, and give it to the event-handler. */ -static void add_listener(char *where, int what) +static int add_listener(char *where, int what) { COMSTACK l; void *ap; @@ -622,26 +622,27 @@ static void add_listener(char *where, int what) if (!l) { yaz_log(LOG_FATAL|LOG_ERRNO, "Failed to listen on %s", where); - return; + return -1; } if (cs_bind(l, ap, CS_SERVER) < 0) { yaz_log(LOG_FATAL|LOG_ERRNO, "Failed to bind to %s", where); cs_close (l); - return; + return -1; } if (!(lst = iochan_create(cs_fileno(l), listener, EVENT_INPUT | EVENT_EXCEPT))) { yaz_log(LOG_FATAL|LOG_ERRNO, "Failed to create IOCHAN-type"); cs_close (l); - return; + return -1; } iochan_setdata(lst, l); /* Ensure our listener chain is setup properly */ lst->next = pListener; pListener = lst; + return 0; /* OK */ } #ifndef WIN32 @@ -751,7 +752,8 @@ int check_options(int argc, char **argv) switch (ret) { case 0: - add_listener(arg, control_block.default_proto); + if (add_listener(arg, control_block.default_proto)) + return 1; /* failed to create listener */ break; case '1': control_block.one_shot = 1; @@ -761,7 +763,8 @@ int check_options(int argc, char **argv) control_block.default_proto = PROTO_Z3950; break; case 's': - control_block.default_proto = PROTO_SR; + fprintf (stderr, "%s: SR protocol no longer supported\n", me); + exit (1); break; case 'S': control_block.dynamic = 0; @@ -828,7 +831,7 @@ int check_options(int argc, char **argv) fprintf(stderr, "Usage: %s [ -a -v " " -l -u -c -t " " -k -d " - " -zsiST -w ... ]\n", me); + " -ziST1 -w ... ]\n", me); return 1; } }