/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2012 Index Data
+ * Copyright (C) 1995-2013 Index Data
* See the file LICENSE for details.
*/
0, /* one shot (single session) */
"", /* no PDUs */
"", /* diagnostic output to stderr */
- "tcp:@:9999", /* default listener port */
PROTO_Z3950, /* default application protocol */
900, /* idle timeout (seconds) */
64*1024*1024, /* maximum PDU size (approx.) to allow */
"", /* NT Service Dependencies */
"Z39.50 Server", /* NT Service Display Name */
#endif /* WIN32 */
- 0, /* SOAP handlers */
"", /* PID fname */
0, /* background daemon */
"", /* SSL certificate filename */
a = 0;
#endif
yaz_log_xml_errors(0, YLOG_WARN);
- yaz_log(log_session, "Session - OK %d %s %ld",
+ yaz_log(log_session, "Session - OK %d %s PID=%ld",
no_sessions, a ? a : "[Unknown]", (long) getpid());
if (max_sessions && no_sessions >= max_sessions)
control_block.one_shot = 1;
else
mode = "static";
- yaz_log(log_server, "Adding %s listener on %s id=%d", mode, where,
- listen_id);
+ yaz_log(log_server, "Adding %s listener on %s id=%d PID=%ld", mode, where,
+ listen_id, (long) getpid());
l = cs_create_host(where, 2, &ap);
if (!l)
iochan_event_loop(pListener);
}
+#ifndef WIN32
+static void normal_stop_handler(int num)
+{
+ yaz_log(log_server, "Received SIGTERM. PID=%ld", (long) getpid());
+ exit(0);
+}
+#endif
+
static int statserv_sc_main(yaz_sc_t s, int argc, char **argv)
{
char sep;
{
xml_config_add_listeners();
- if (!pListener && *control_block.default_listen)
- add_listener(control_block.default_listen, 0);
+ if (!pListener)
+ add_listener("tcp:@:9999", 0);
#ifndef WIN32
if (control_block.dynamic)
return 1;
if (s)
yaz_sc_running(s);
- yaz_log(YLOG_DEBUG, "Entering event loop.");
+#ifndef WIN32
+ signal(SIGTERM, normal_stop_handler);
+#endif
yaz_daemon(programname,
(control_block.background ? YAZ_DAEMON_FORK : 0),
daemon_handler, &pListener,
static void option_copy(char *dst, const char *src)
{
- strncpy(dst, src ? src : "", 127);
- dst[127] = '\0';
+ strncpy(dst, src ? src : "", BEND_NAME_MAX-1);
+ dst[BEND_NAME_MAX-1] = '\0';
}
int check_options(int argc, char **argv)