[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11089 - gnunet/src/hostlist
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11089 - gnunet/src/hostlist |
Date: |
Wed, 28 Apr 2010 10:55:59 +0200 |
Author: wachs
Date: 2010-04-28 10:55:59 +0200 (Wed, 28 Apr 2010)
New Revision: 11089
Modified:
gnunet/src/hostlist/hostlist-client.c
gnunet/src/hostlist/hostlist-client.h
gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c
gnunet/src/hostlist/test_learning_adv_peer.conf
Log:
- Implemented download limit on client side
- Disabled verbose
Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c 2010-04-28 08:47:53 UTC (rev
11088)
+++ gnunet/src/hostlist/hostlist-client.c 2010-04-28 08:55:59 UTC (rev
11089)
@@ -36,7 +36,7 @@
#include "gnunet_common.h"
#include "gnunet_bio_lib.h"
-#define DEBUG_HOSTLIST_CLIENT GNUNET_YES
+#define DEBUG_HOSTLIST_CLIENT GNUNET_NO
/**
@@ -151,7 +151,7 @@
/**
*
*/
-static uint32_t bytes_downloaded;
+static uint32_t stat_bytes_downloaded;
/**
* Amount of time we wait between hostlist downloads.
*/
@@ -280,16 +280,12 @@
uint16_t msize;
total = size * nmemb;
- bytes_downloaded = total;
+ stat_bytes_downloaded += total;
if ( (total == 0) || (stat_bogus_url) )
{
return total; /* ok, no data or bogus data */
}
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Total: %u, nmeb: %u, size %u \n"),
- total, nmemb, size);
-
GNUNET_STATISTICS_update (stats,
gettext_noop ("# bytes downloaded from hostlist
servers"),
(int64_t) total,
@@ -711,7 +707,7 @@
}
GNUNET_free_non_null (current_url);
current_url = NULL;
- bytes_downloaded = 0;
+ stat_bytes_downloaded = 0;
stat_download_in_progress = GNUNET_NO;
}
@@ -808,7 +804,6 @@
struct CURLMsg *msg;
CURLMcode mret;
- bytes_downloaded = 0;
ti_download = GNUNET_SCHEDULER_NO_TASK;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
@@ -838,7 +833,7 @@
do
{
running = 0;
- if (bytes_downloaded > MAX_BYTES_PER_HOSTLISTS)
+ if (stat_bytes_downloaded > MAX_BYTES_PER_HOSTLISTS)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Download limit of %u bytes exceeded,
stopping download\n"),MAX_BYTES_PER_HOSTLISTS);
@@ -937,6 +932,7 @@
stat_download_in_progress = GNUNET_YES;
stat_download_successful = GNUNET_NO;
stat_hellos_obtained = 0;
+ stat_bytes_downloaded = 0;
GNUNET_STATISTICS_update (stats,
gettext_noop ("# hostlist downloads initiated"),
Modified: gnunet/src/hostlist/hostlist-client.h
===================================================================
--- gnunet/src/hostlist/hostlist-client.h 2010-04-28 08:47:53 UTC (rev
11088)
+++ gnunet/src/hostlist/hostlist-client.h 2010-04-28 08:55:59 UTC (rev
11089)
@@ -33,7 +33,7 @@
#include "gnunet_time_lib.h"
#define MAX_NUMBER_HOSTLISTS 30
-#define MAX_BYTES_PER_HOSTLISTS 50000
+#define MAX_BYTES_PER_HOSTLISTS 100000
#define SAVING_INTERVALL GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES, 30)
#define TESTING_INTERVALL GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 3)
#define WAITING_INTERVALL GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 1)
Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c 2010-04-28
08:47:53 UTC (rev 11088)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c 2010-04-28
08:55:59 UTC (rev 11089)
@@ -30,7 +30,7 @@
#include "gnunet_resolver_service.h"
#include "gnunet_statistics_service.h"
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
#define START_ARM GNUNET_YES
#define MAX_URL_LEN 1000
@@ -43,15 +43,11 @@
static int timeout;
static int adv_sent;
+static int adv_arrived;
-static int adv_arrived_p1;
-static int learned_hostlist_saved_p1;
-static int learned_hostlist_downloaded_p1;
+static int learned_hostlist_saved;
+static int learned_hostlist_downloaded;
-static int adv_arrived_p2;
-static int learned_hostlist_saved_p2;
-static int learned_hostlist_downloaded_p2;
-
static char * current_adv_uri;
static struct GNUNET_SCHEDULER_Handle *sched;
@@ -76,9 +72,6 @@
static struct PeerContext learn_peer;
-static struct PeerContext learn_peer2;
-
-
static void
waitpid_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -144,12 +137,6 @@
GNUNET_TRANSPORT_disconnect (learn_peer.th);
learn_peer.th = NULL;
}
- /*
- if (learn_peer2.th != NULL)
- {
- GNUNET_TRANSPORT_disconnect (learn_peer2.th);
- learn_peer2.th = NULL;
- }*/
if (adv_peer.core != NULL)
{
GNUNET_CORE_disconnect (adv_peer.core);
@@ -160,20 +147,11 @@
GNUNET_CORE_disconnect (learn_peer.core);
learn_peer.core = NULL;
}
- /*
- if (learn_peer2.core != NULL)
- {
- GNUNET_CORE_disconnect (learn_peer2.core);
- learn_peer2.core = NULL;
- }*/
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking ARM to stop core services\n");
learn_peer.arm = GNUNET_ARM_connect (learn_peer.cfg, sched, NULL);
GNUNET_ARM_stop_service (learn_peer.arm, "core", GNUNET_TIME_UNIT_SECONDS,
&stop_cb, &learn_peer);
- /* learn_peer2.arm = GNUNET_ARM_connect (learn_peer2.cfg, sched, NULL);
- GNUNET_ARM_stop_service (learn_peer2.arm, "core", GNUNET_TIME_UNIT_SECONDS,
- &stop_cb, &learn_peer2);*/
adv_peer.arm = GNUNET_ARM_connect (adv_peer.cfg, sched, NULL);
GNUNET_ARM_stop_service (adv_peer.arm, "core", GNUNET_TIME_UNIT_SECONDS,
&stop_cb, &adv_peer);
@@ -203,20 +181,13 @@
{
- if ( ((struct PeerContext *) cls == &learn_peer) && (value == 2) &&
(learned_hostlist_downloaded_p1 == GNUNET_NO) )
+ if ( ((struct PeerContext *) cls == &learn_peer) && (value == 2) &&
(learned_hostlist_downloaded == GNUNET_NO) )
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Peer1 has successfully downloaded advertised URI \n"));
- learned_hostlist_downloaded_p1 = GNUNET_YES;
+ _("Peer has successfully downloaded advertised URI \n"));
+ learned_hostlist_downloaded = GNUNET_YES;
}
- /*
- if ( ((struct PeerContext *) cls == &learn_peer2) && (value == 2) &&
(learned_hostlist_downloaded_p2 == GNUNET_NO) )
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Peer2 has successfully downloaded advertised URI \n"));
- learned_hostlist_downloaded_p2 = GNUNET_YES;
- }*/
- if ( (GNUNET_NO != learned_hostlist_downloaded_p1) /*&& (GNUNET_NO !=
learned_hostlist_downloaded_p2)*/ )
+ if (GNUNET_NO != learned_hostlist_downloaded)
shutdown_testcase();
return GNUNET_OK;
}
@@ -228,19 +199,12 @@
uint64_t value,
int is_persistent)
{
- if ( ((struct PeerContext *) cls == &learn_peer) && (value == 1) &&
(learned_hostlist_saved_p1 == GNUNET_NO))
+ if ( ((struct PeerContext *) cls == &learn_peer) && (value == 1) &&
(learned_hostlist_saved == GNUNET_NO))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Peer1 has successfully saved advertised URI \n"));
- learned_hostlist_saved_p1 = GNUNET_YES;
+ _("Peer has successfully saved advertised URI \n"));
+ learned_hostlist_saved = GNUNET_YES;
}
- /*
- if ( ((struct PeerContext *) cls == &learn_peer2) && (value == 1) &&
(learned_hostlist_saved_p2 == GNUNET_NO))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Peer2 has successfully saved advertised URI \n"));
- learned_hostlist_saved_p2 = GNUNET_YES;
- }*/
return GNUNET_OK;
}
@@ -278,13 +242,6 @@
NULL,
&process_downloads,
&learn_peer);
- /*GNUNET_STATISTICS_get (learn_peer2.stats,
- "hostlist",
- stat,
- GNUNET_TIME_UNIT_MINUTES,
- NULL,
- &process_downloads,
- &learn_peer2);*/
GNUNET_free (stat);
GNUNET_STATISTICS_get (learn_peer.stats,
@@ -294,13 +251,6 @@
NULL,
&process_uris_recv,
&learn_peer);
- /*GNUNET_STATISTICS_get (learn_peer2.stats,
- "hostlist",
- gettext_noop("# advertised hostlist URIs"),
- GNUNET_TIME_UNIT_MINUTES,
- NULL,
- &process_uris_recv,
- &learn_peer2);*/
GNUNET_STATISTICS_get (adv_peer.stats,
"hostlist",
gettext_noop("# hostlist advertisements send"),
@@ -363,8 +313,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Recieved hostlist advertisement with URI `%s' as expected\n",
current_adv_uri);
- adv_arrived_p1 = GNUNET_YES;
- adv_arrived_p2 = GNUNET_YES;
+ adv_arrived = GNUNET_YES;
}
else
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -456,14 +405,10 @@
timeout = GNUNET_NO;
adv_sent =GNUNET_NO;
- adv_arrived_p1 = GNUNET_NO;
- learned_hostlist_downloaded_p1 = GNUNET_NO;
- learned_hostlist_saved_p1 = GNUNET_NO;
+ adv_arrived = 0;
+ learned_hostlist_saved = GNUNET_NO;
+ learned_hostlist_downloaded = GNUNET_NO;
- /*adv_arrived_p2 = GNUNET_NO;
- learned_hostlist_downloaded_p2 = GNUNET_NO;
- learned_hostlist_saved_p2 = GNUNET_NO;*/
-
sched = s;
timeout_task = GNUNET_SCHEDULER_add_delayed (sched,
TIMEOUT,
@@ -476,8 +421,6 @@
setup_adv_peer (&adv_peer, "test_learning_adv_peer.conf");
setup_learn_peer (&learn_peer, "test_learning_learn_peer.conf");
- // setup_learn_peer (&learn_peer2, "test_learning_learn_peer2.conf");
-
}
@@ -508,44 +451,24 @@
"Testcase could not set up two communicating peers,
timeout\n");
failed = GNUNET_YES;
}
- if (adv_arrived_p1 == GNUNET_NO)
+ if (adv_arrived != GNUNET_YES)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Peer1: Learning peer did not recieve advertisement from
server\n");
+ "Learning peer did not receive advertisement from server\n");
failed = GNUNET_YES;
}
- if ( learned_hostlist_saved_p1 == GNUNET_NO )
+ if ( learned_hostlist_saved == GNUNET_NO )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Peer1: Advertised hostlist was not saved in datastore\n");
failed = GNUNET_YES;
}
- if (learned_hostlist_downloaded_p1 == GNUNET_NO)
+ if (learned_hostlist_downloaded == GNUNET_NO)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Peer1: Advertised hostlist could not be downloaded from
server\n");
failed = GNUNET_YES;
}
- /*
- if (adv_arrived_p2 == GNUNET_NO)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Peer2: Learning peer did not recieve advertisement from
server\n");
- failed = GNUNET_YES;
- }
- if ( learned_hostlist_saved_p2 == GNUNET_NO )
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Peer2: Advertised hostlist was not saved in datastore\n");
- failed = GNUNET_YES;
- }
- if (learned_hostlist_downloaded_p2 == GNUNET_NO)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Peer2: Advertised hostlist could not be downloaded from
server\n");
- failed = GNUNET_YES;
- }*/
-
if (adv_sent == GNUNET_NO)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
Modified: gnunet/src/hostlist/test_learning_adv_peer.conf
===================================================================
--- gnunet/src/hostlist/test_learning_adv_peer.conf 2010-04-28 08:47:53 UTC
(rev 11088)
+++ gnunet/src/hostlist/test_learning_adv_peer.conf 2010-04-28 08:55:59 UTC
(rev 11089)
@@ -36,7 +36,7 @@
[hostlist]
HTTPPORT = 12981
SERVERS = http://localhost:12981/
-OPTIONS = -p -a -b -e
+OPTIONS = -p -a
#OPTIONS = -b -p -a
#DEBUG = YES
HOSTLISTFILE = hostlists_adv_peer.file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11089 - gnunet/src/hostlist,
gnunet <=