/*
- * 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.77 2001-10-05 14:43:22 adam Exp $
+ * $Id: statserv.c,v 1.85 2002-09-25 12:37:07 adam Exp $
*/
#include <stdio.h>
}
}
-void event_loop_thread (IOCHAN iochan)
+void __cdecl event_loop_thread (IOCHAN iochan)
{
event_loop (&iochan);
}
char dummy[1];
int res;
- if ((res = read(hand[0], dummy, 1)) < 0 && errno != EINTR)
+ if ((res = read(hand[0], dummy, 1)) < 0 &&
+ yaz_errno() != EINTR)
{
yaz_log(LOG_FATAL|LOG_ERRNO, "handshake read");
return;
/*
* 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;
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
{
int ret;
- nmem_init ();
#ifdef WIN32
/* We need to initialize the thread list */
ThreadList_Initialize();
yaz_log(LOG_LOG, "Entering event loop.");
ret = event_loop(&pListener);
}
- nmem_exit ();
return ret;
}
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;
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;
fprintf(stderr, "Usage: %s [ -a <pdufile> -v <loglevel>"
" -l <logfile> -u <user> -c <config> -t <minutes>"
" -k <kilobytes> -d <daemon>"
- " -zsiST -w <directory> <listender-addr>... ]\n", me);
+ " -ziST1 -w <directory> <listender-addr>... ]\n", me);
return 1;
}
}
/* Now setup the service with the service controller */
SetupService(argc, argv, &ArgDetails, SZAPPNAME,
cb->service_name, /* internal service name */
- cb->service_name, /* displayed name of the service */
+ cb->service_display_name, /* displayed name */
SZDEPENDENCIES);
return 0;
}