projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
[yaz-moved-to-github.git]
/
src
/
statserv.c
diff --git
a/src/statserv.c
b/src/statserv.c
index
4def68a
..
7560058
100644
(file)
--- a/
src/statserv.c
+++ b/
src/statserv.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
@@
-8,6
+8,10
@@
* \brief Implements GFS logic
*/
* \brief Implements GFS logic
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@
-117,7
+121,8
@@
statserv_options_block control_block = {
"", /* PID fname */
0, /* background daemon */
"", /* SSL certificate filename */
"", /* PID fname */
0, /* background daemon */
"", /* SSL certificate filename */
- "" /* XML config filename */
+ "", /* XML config filename */
+ 1 /* keepalive */
};
static int max_sessions = 0;
};
static int max_sessions = 0;
@@
-605,6
+610,8
@@
static void xml_config_bend_stop(void)
}
}
}
}
+static void remove_listeners(void);
+
/*
* handle incoming connect requests.
* The dynamic mode is a bit tricky mostly because we want to avoid
/*
* handle incoming connect requests.
* The dynamic mode is a bit tricky mostly because we want to avoid
@@
-904,6
+911,9
@@
static void listener(IOCHAN h, int event)
return;
}
return;
}
+ if (control_block.one_shot)
+ remove_listeners();
+
yaz_log(log_sessiondetail, "Connect from %s", cs_addrstr(new_line));
no_sessions++;
yaz_log(log_sessiondetail, "Connect from %s", cs_addrstr(new_line));
no_sessions++;
@@
-1124,6
+1134,13
@@
static int add_listener(char *where, int listen_id)
return 0; /* OK */
}
return 0; /* OK */
}
+static void remove_listeners(void)
+{
+ IOCHAN l = pListener;
+ for (; l; l = l->next)
+ iochan_destroy(l);
+}
+
#ifndef WIN32
/* UNIX only (for windows we don't need to catch the signals) */
static void catchchld(int num)
#ifndef WIN32
/* UNIX only (for windows we don't need to catch the signals) */
static void catchchld(int num)
@@
-1259,7
+1276,7
@@
int check_options(int argc, char **argv)
get_logbits(1);
get_logbits(1);
- while ((ret = options("1a:iszSTl:v:u:c:w:t:k:d:A:p:DC:f:m:r:",
+ while ((ret = options("1a:iszSTl:v:u:c:w:t:k:Kd:A:p:DC:f:m:r:",
argv, argc, &arg)) != -2)
{
switch (ret)
argv, argc, &arg)) != -2)
{
switch (ret)
@@
-1337,6
+1354,9
@@
int check_options(int argc, char **argv)
}
control_block.maxrecordsize = r * 1024;
break;
}
control_block.maxrecordsize = r * 1024;
break;
+ case 'K':
+ control_block.keepalive = 0;
+ break;
case 'i':
control_block.inetd = 1;
break;
case 'i':
control_block.inetd = 1;
break;