summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-02-23 01:48:36 +0300
committerAndrei Karas <akaras@inbox.ru>2019-03-11 03:04:57 +0300
commit4af6f3c375f860bfb19f3ebef7ad2ec9ee18deaa (patch)
tree6cf5b5f6689130482d565ddfc04eed7dcaa688ac
parentdd742ed655c1d6344c8ca88f86f246200da32b04 (diff)
downloadhercules-4af6f3c375f860bfb19f3ebef7ad2ec9ee18deaa.tar.gz
hercules-4af6f3c375f860bfb19f3ebef7ad2ec9ee18deaa.tar.bz2
hercules-4af6f3c375f860bfb19f3ebef7ad2ec9ee18deaa.tar.xz
hercules-4af6f3c375f860bfb19f3ebef7ad2ec9ee18deaa.zip
Move variable SOCKET_CONF_FILENAME into socket interface
-rw-r--r--src/common/socket.c8
-rw-r--r--src/common/socket.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index 2dda7d008..faf57f412 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -79,8 +79,6 @@
static struct socket_interface sockt_s;
struct socket_interface *sockt;
-static const char *SOCKET_CONF_FILENAME = "conf/common/socket.conf";
-
#ifdef SEND_SHORTLIST
// Add a fd to the shortlist so that it'll be recognized as a fd that needs
// sending done on it.
@@ -1505,7 +1503,7 @@ static bool socket_config_read(const char *filename, bool imported)
// import should overwrite any previous configuration, so it should be called last
if (libconfig->lookup_string(&config, "import", &import) == CONFIG_TRUE) {
- if (strcmp(import, filename) == 0 || strcmp(import, SOCKET_CONF_FILENAME) == 0) {
+ if (strcmp(import, filename) == 0 || strcmp(import, sockt->SOCKET_CONF_FILENAME) == 0) {
ShowWarning("socket_config_read: Loop detected! Skipping 'import'...\n");
} else {
if (!socket_config_read(import, true))
@@ -1714,7 +1712,7 @@ static void socket_init(void)
// Get initial local ips
sockt->naddr_ = sockt->getips(sockt->addr_,16);
- socket_config_read(SOCKET_CONF_FILENAME, false);
+ socket_config_read(sockt->SOCKET_CONF_FILENAME, false);
#ifndef SOCKET_EPOLL
// Select based Event Dispatcher:
@@ -2143,6 +2141,8 @@ void socket_defaults(void)
{
sockt = &sockt_s;
+ sockt->SOCKET_CONF_FILENAME = "conf/common/socket.conf";
+
sockt->fd_max = 0;
/* */
sockt->stall_time = 60;
diff --git a/src/common/socket.h b/src/common/socket.h
index 01e919a89..193b22645 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -178,6 +178,7 @@ struct socket_interface {
time_t stall_time;
time_t last_tick;
+ const char *SOCKET_CONF_FILENAME;
/* */
uint32 addr_[16]; // ip addresses of local host (host byte order)
int naddr_; // # of ip addresses