[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10896 - gnunet/src/hostlist
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10896 - gnunet/src/hostlist |
Date: |
Tue, 13 Apr 2010 14:56:48 +0200 |
Author: wachs
Date: 2010-04-13 14:56:48 +0200 (Tue, 13 Apr 2010)
New Revision: 10896
Modified:
gnunet/src/hostlist/hostlist-client.c
gnunet/src/hostlist/learning_peer2.conf
Log:
added methods to load and write hostfiles
Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c 2010-04-13 12:14:08 UTC (rev
10895)
+++ gnunet/src/hostlist/hostlist-client.c 2010-04-13 12:56:48 UTC (rev
10896)
@@ -787,8 +787,53 @@
return GNUNET_OK;
}
+/**
+ * Method to load persistent hostlist file during hostlist client startup
+ * param c configuration to use
+ */
+static int load_hostlist_file ()
+{
+ char *servers;
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "HOSTLIST",
+ "HOSTLISTFILE",
+ &servers))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("No `%s' specified in `%s' configuration, cannot load
hostlists from file.\n"),
+ "HOSTLISTFILE", "HOSTLIST");
+ return GNUNET_SYSERR;
+ }
+ return GNUNET_OK;
+}
+
/**
+ * Method to load persistent hostlist file during hostlist client shutdown
+ * param c configuration to use
+ */
+static int save_hostlist_file ()
+{
+ char *servers;
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "HOSTLIST",
+ "HOSTLISTFILE",
+ &servers))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("No `%s' specified in `%s' configuration, cannot save
hostlist to file.\n"),
+ "HOSTLISTFILE", "HOSTLIST");
+ return GNUNET_SYSERR;
+ }
+
+
+ return GNUNET_OK;
+}
+
+/**
* Start downloading hostlists from hostlist servers as necessary.
*/
int
@@ -822,6 +867,9 @@
*ch = &connect_handler;
*dh = &disconnect_handler;
*msgh = &advertisement_handler;
+
+ load_hostlist_file ();
+
GNUNET_STATISTICS_get (stats,
"hostlist",
gettext_noop("# seconds between hostlist downloads"),
@@ -843,6 +891,8 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Hostlist client shutdown\n");
#endif
+ save_hostlist_file ();
+
if (current_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (sched,
Modified: gnunet/src/hostlist/learning_peer2.conf
===================================================================
--- gnunet/src/hostlist/learning_peer2.conf 2010-04-13 12:14:08 UTC (rev
10895)
+++ gnunet/src/hostlist/learning_peer2.conf 2010-04-13 12:56:48 UTC (rev
10896)
@@ -36,7 +36,7 @@
[hostlist]
HTTPPORT = 12981
SERVERS = http://localhost:12980/
-OPTIONS = -b -p -e -a
+OPTIONS = -b -p -e
DEBUG = YES
#BINARY = /home/grothoff/bin/gnunet-daemon-hostlist
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10896 - gnunet/src/hostlist,
gnunet <=