From: Matthias Wachs Date: Thu, 29 Apr 2010 14:39:13 +0000 (+0000) Subject: Added configuration option to set hostname used for advertisements X-Git-Tag: initial-import-from-subversion-38251~21956 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=33fa9a700082513870a85b56c7359e72ed29035f;p=oweals%2Fgnunet.git Added configuration option to set hostname used for advertisements Fixes problems on systems with misconfigured dns resolution for local hostname --- diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index f660da66e..7ea495064 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c @@ -601,10 +601,17 @@ GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c, "HTTPPORT", &port)) return GNUNET_SYSERR; + + + if ( GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, + "HOSTLIST", + "HOSTNAME", + &hostname)) + hostname = GNUNET_RESOLVER_local_fqdn_get (); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Hostlist service starts on port %llu\n"), - port); - hostname = GNUNET_RESOLVER_local_fqdn_get (); + _("Hostlist service starts on %s:%llu\n"), + hostname, port); if (NULL != hostname) { size = strlen (hostname); diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index 3098844e9..6510bca33 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c @@ -290,7 +290,13 @@ static int ad_arrive_handler (void *cls, if ( NULL != expected_uri ) GNUNET_free ( expected_uri ); return GNUNET_SYSERR; } - hostname = GNUNET_RESOLVER_local_fqdn_get (); + + if ( GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (adv_peer.cfg, + "HOSTLIST", + "HOSTNAME", + &hostname)) + hostname = GNUNET_RESOLVER_local_fqdn_get (); + if (NULL != hostname) { size = strlen (hostname); diff --git a/src/hostlist/test_learning_adv_peer.conf b/src/hostlist/test_learning_adv_peer.conf index 0ed2829f9..3888b9f47 100644 --- a/src/hostlist/test_learning_adv_peer.conf +++ b/src/hostlist/test_learning_adv_peer.conf @@ -34,6 +34,7 @@ PORT = 22970 WEAKRANDOM = YES [hostlist] +HOSTNAME = localhost HTTPPORT = 12981 SERVERS = http://localhost:12981/ OPTIONS = -p -a