[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10976 - gnunet/src/hostlist
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10976 - gnunet/src/hostlist |
Date: |
Mon, 19 Apr 2010 15:10:14 +0200 |
Author: wachs
Date: 2010-04-19 15:10:14 +0200 (Mon, 19 Apr 2010)
New Revision: 10976
Modified:
gnunet/src/hostlist/hostlist-client.c
Log:
hostlist file now gets deleted if learning is disabled
Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c 2010-04-19 12:35:59 UTC (rev
10975)
+++ gnunet/src/hostlist/hostlist-client.c 2010-04-19 13:10:14 UTC (rev
10976)
@@ -194,7 +194,6 @@
*/
static struct Hostlist * current_hostlist;
-
/*
* Size of the linke list used to store hostlists
*/
@@ -216,7 +215,7 @@
static unsigned int hellos_obtained;
/**
- * Value saying how many valid HELLO messages were obtained during download
+ * Value saying if hostlist download was successful
*/
static unsigned int download_successful;
@@ -470,7 +469,7 @@
}
/**
- * substract val2 from val1 with underflow check
+ * Subtract val2 from val1 with underflow check
* return = val1 - val2
* @val1 value 1
* @val2 value 2
@@ -500,7 +499,7 @@
if ( GNUNET_YES == download_successful )
{
current_hostlist->times_used++;
- current_hostlist->quality = checked_add( current_hostlist->quality,
HOSTLIST_SUCCESSFUL_DOWNLOAD);
+ current_hostlist->quality = checked_add ( current_hostlist->quality,
HOSTLIST_SUCCESSFUL_DOWNLOAD);
}
else
current_hostlist->quality = checked_sub ( current_hostlist->quality,
HOSTLIST_FAILED_DOWNLOAD );
@@ -1306,6 +1305,9 @@
GNUNET_CORE_MessageCallback *msgh,
int learn)
{
+ char *filename;
+ int result;
+
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
{
GNUNET_break (0);
@@ -1353,6 +1355,22 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Learning is not enabled on this peer\n"));
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
+ "HOSTLIST",
+ "HOSTLISTFILE",
+ &filename))
+ {
+ if ( GNUNET_YES == GNUNET_DISK_file_test (filename) )
+ {
+ result = remove (filename);
+ if (result == 0)
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Since learning is not enabled on this peer, hostlist file
`%s' was removed\n"),filename);
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Hostlist file `%s' could not be removed\n"),filename);
+ }
+ }
}
GNUNET_STATISTICS_get (stats,
"hostlist",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10976 - gnunet/src/hostlist,
gnunet <=