diff options
| author | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2012-08-19 13:05:11 +0000 |
|---|---|---|
| committer | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2012-08-19 13:05:11 +0000 |
| commit | fd9584d08d428d3ba87c08b79317eb0b2c88300f (patch) | |
| tree | cb29ffba42039caa3048136c896b7fc49cad7d12 | |
| parent | 8babce2b7eba089b3102afd2fa75156ed8453f47 (diff) | |
| download | pica-pica-fd9584d08d428d3ba87c08b79317eb0b2c88300f.tar.gz pica-pica-fd9584d08d428d3ba87c08b79317eb0b2c88300f.zip | |
default nodelist database location based on localstatedir variable; fail if announced_addr is not properly configured
git-svn-id: svn://localhost/project_picapica/trunk@171 fb96df88-216d-11de-830c-f3023f12d8ac
| -rw-r--r-- | Makefile.am | 4 | ||||
| -rwxr-xr-x | PICA_node.c | 8 | ||||
| -rw-r--r-- | PICA_nodeconfig.h | 6 | ||||
| -rw-r--r-- | pica-node.conf.5 | 8 |
4 files changed, 18 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index abde805..e9cff84 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,9 +22,9 @@ pica_node_SOURCES = PICA_node.c PICA_msgproc.c PICA_nodeaddrlist.c \ dist_man_MANS = pica-node.8 pica-node.conf.5 -pica_node_CPPFLAGS = -DPICA_INSTALLPREFIX=\"$(prefix)\" -DPICA_SYSCONFDIR=\"$(sysconfdir)\" +pica_node_CPPFLAGS = -DPICA_INSTALLPREFIX=\"$(prefix)\" -DPICA_SYSCONFDIR=\"$(sysconfdir)\" -DPICA_LOCALSTATEDIR=\"$(localstatedir)\" -pkglocalstatedir = $(localstatedir)/pica-node +pkglocalstatedir = $(localstatedir)/lib/pica-node dist_pkglocalstate_DATA = nodelist.db diff --git a/PICA_node.c b/PICA_node.c index 763b394..d71d43f 100755 --- a/PICA_node.c +++ b/PICA_node.c @@ -2427,8 +2427,12 @@ PICA_debug1("nodecfg.nodes_db_file = %s",nodecfg.nodes_db_file); if (!PICA_node_init()) return -1; -//if (PICA_node_joinskynet("nodelist")<=0)//CONF имя файла - /*return -1*/;//вывести предупреждение, что ни к одному другому узлу подключиться не удалось +if (INADDR_NONE == inet_addr(nodecfg.announced_addr) || INADDR_ANY == inet_addr(nodecfg.announced_addr)) + { + PICA_fatal("announced_addr (%.16s) is invalid or not configured. Please set correct public IP address of your pica-node instance in config file", + nodecfg.announced_addr + ); + } PICA_node_joinskynet(nodecfg.nodes_db_file, nodecfg.announced_addr);//CONF-CONF имя файла с адресами узлов, свой адрес diff --git a/PICA_nodeconfig.h b/PICA_nodeconfig.h index 66e02ef..9790256 100644 --- a/PICA_nodeconfig.h +++ b/PICA_nodeconfig.h @@ -10,9 +10,13 @@ #define PICA_SYSCONFDIR "/etc" #endif +#ifndef PICA_LOCALSTATEDIR +#define PICA_LOCALSTATEDIR "/var" +#endif + #define PICA_NODECONFIG_DEF_ANNOUNCED_ADDR "0.0.0.0" #define PICA_NODECONFIG_DEF_LISTEN_PORT "2299" -#define PICA_NODECONFIG_DEF_NODES_DB_FILE "/var/lib/pica-node/nodelist.db" +#define PICA_NODECONFIG_DEF_NODES_DB_FILE PICA_LOCALSTATEDIR"/lib/pica-node/nodelist.db" #define PICA_NODECONFIG_DEF_CONFIG_FILE PICA_SYSCONFDIR"/pica-node.conf" #define PICA_NODECONFIG_DEF_CA_CERT_FILE PICA_INSTALLPREFIX"/share/pica-node/CA.pem" diff --git a/pica-node.conf.5 b/pica-node.conf.5 index 391f4c9..634bd3f 100644 --- a/pica-node.conf.5 +++ b/pica-node.conf.5 @@ -16,9 +16,11 @@ section. The possible options and their meanings are as follows: .TP .I announced_addr Network address that can be used to reach this instance of pica-node. -Can be specified in form of DNS name or IPv4 adress. If the computer -running pica-node is behind NAT, external public address of NAT machine -must be specified and port forwarding must be configured. +Can be specified in form of DNS name or IP adress (Right now only IPv4 +address format is supported. IPv6 and domain name support will be added in +future releases). If the computer running pica-node is behind the NAT, external + public address of NAT machine must be specified and port forwarding must be + configured. .TP .I listen_port Specifies the port number that |
