*/
#define DATA_HOST_CLEAN_FREQ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 60)
-#define WRITE_TO_DISK GNUNET_NO
-
/**
* In-memory cache of known hosts.
*/
}
-#if WRITE_TO_DISK
/**
* Address iterator that causes expired entries to be discarded.
*
"%s%s%s", networkIdDirectory, DIR_SEPARATOR_STR, &fil);
return fn;
}
-#endif
/**
add_host_to_known_hosts (const struct GNUNET_PeerIdentity *identity)
{
struct HostEntry *entry;
-#if WRITE_TO_DISK
char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
const struct GNUNET_HELLO_Message *hello;
struct GNUNET_HELLO_Message *hello_clean;
int size;
struct GNUNET_TIME_Absolute now;
char *fn;
-#endif
entry = GNUNET_CONTAINER_multihashmap_get (hostmap,
&identity->hashPubKey);
GNUNET_NO);
entry = GNUNET_malloc (sizeof (struct HostEntry));
entry->identity = *identity;
-#if WRITE_TO_DISK
+
fn = get_host_filename (identity);
if (GNUNET_DISK_file_test (fn) == GNUNET_YES)
{
}
}
GNUNET_free (fn);
-#endif
GNUNET_CONTAINER_multihashmap_put (hostmap,
&identity->hashPubKey,
entry,
notify_all (entry);
}
-#if WRITE_TO_DISK
+
/**
* Remove a file that should not be there. LOG
* success or failure.
GNUNET_SCHEDULER_add_delayed (DATA_HOST_FREQ,
&cron_scan_directory_data_hosts, NULL);
}
-#endif
+
/**
* Bind a host address (hello) to a hostId.
bind_address (const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Message *hello)
{
-#if WRITE_TO_DISK
char *fn;
-#endif
struct HostEntry *host;
struct GNUNET_HELLO_Message *mrg;
struct GNUNET_TIME_Absolute delta;
GNUNET_free (host->hello);
host->hello = mrg;
}
-#if WRITE_TO_DISK
fn = get_host_filename (peer);
if (GNUNET_OK == GNUNET_DISK_directory_create_for_file (fn))
{
}
GNUNET_free (fn);
-#endif
notify_all (host);
}
return GNUNET_YES;
}
-#if WRITE_TO_DISK
+
/**
* @brief delete expired HELLO entries in data/hosts/
*/
GNUNET_SCHEDULER_add_delayed (DATA_HOST_CLEAN_FREQ,
&cron_clean_data_hosts, NULL);
}
-#endif
/**
hostmap = GNUNET_CONTAINER_multihashmap_create (1024);
stats = GNUNET_STATISTICS_create ("peerinfo", cfg);
notify_list = GNUNET_SERVER_notification_context_create (server, 0);
-#if WRITE_TO_DISK
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_filename (cfg,
"peerinfo",
&cron_scan_directory_data_hosts, NULL);
GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
&cron_clean_data_hosts, NULL);
-#endif
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
GNUNET_SERVER_add_handlers (server, handlers);