[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13967 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13967 - gnunet/src/dht |
Date: |
Tue, 21 Dec 2010 14:52:30 +0100 |
Author: nevans
Date: 2010-12-21 14:52:30 +0100 (Tue, 21 Dec 2010)
New Revision: 13967
Modified:
gnunet/src/dht/gnunet-dht-driver.c
gnunet/src/dht/gnunet-service-dht.c
Log:
core connect change, forgotten dht driver change
Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c 2010-12-21 13:50:48 UTC (rev 13966)
+++ gnunet/src/dht/gnunet-dht-driver.c 2010-12-21 13:52:30 UTC (rev 13967)
@@ -501,6 +501,12 @@
static unsigned int get_from_same;
/**
+ * Should malicious peers be set after allowing for settle time?
+ * Default is to set them malicious after initial connection setup.
+ */
+static unsigned int malicious_after_settle;
+
+/**
* Number of rounds for testing (PUTS + GETS)
*/
static unsigned long long total_rounds;
@@ -1933,6 +1939,9 @@
static void
schedule_find_peer_requests (void *cls, const struct
GNUNET_SCHEDULER_TaskContext * tc);
+static void
+setup_malicious_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *
tc);
+
/**
* Given a number of total peers and a bucket size, estimate the number of
* connections in a perfect kademlia topology.
@@ -1993,6 +2002,9 @@
GNUNET_CONTAINER_heap_destroy(find_peer_context->peer_min_heap);
GNUNET_free(find_peer_context);
fprintf(stderr, "Not sending any more find peer requests.\n");
+
+ if (GNUNET_YES == malicious_after_settle)
+ GNUNET_SCHEDULER_add_now(&setup_malicious_peers, NULL);
}
}
}
@@ -2324,8 +2336,11 @@
}
else /* Otherwise, continue testing */
{
- GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Scheduling continue_puts_and_gets
now!\n");
- GNUNET_SCHEDULER_add_now (&continue_puts_and_gets, NULL);
+ if (cls != NULL)
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Scheduling
continue_puts_and_gets now!\n");
+ GNUNET_SCHEDULER_add_now (&continue_puts_and_gets, NULL);
+ }
}
}
@@ -2390,21 +2405,22 @@
}
GNUNET_SCHEDULER_cancel (die_task);
- /*die_task = GNUNET_SCHEDULER_add_delayed (DEFAULT_TIMEOUT,
- &end_badly, "from setup
puts/gets");*/
+
if ((dhtlog_handle != NULL) && (settle_time > 0))
{
topo_ctx = GNUNET_malloc(sizeof(struct TopologyIteratorContext));
- topo_ctx->cont = &setup_malicious_peers;
+ if (GNUNET_YES == malicious_after_settle) /* Don't set malicious
peers until after settle_time */
+ topo_ctx->cont = &continue_puts_and_gets;
+ else /* Set malicious peers now */
+ topo_ctx->cont = &setup_malicious_peers;
topo_ctx->peers_seen =
GNUNET_CONTAINER_multihashmap_create(num_peers);
- //topo_ctx->cont = &continue_puts_and_gets;
+ topo_ctx->cls = NULL;
+ //
GNUNET_SCHEDULER_add_now(&capture_current_topology, topo_ctx);
}
else
{
- GNUNET_SCHEDULER_add_now(&setup_malicious_peers, NULL);
- /*GNUNET_SCHEDULER_add_delayed
(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time),
- &continue_puts_and_gets, NULL);*/
+ GNUNET_SCHEDULER_add_now(&setup_malicious_peers,
&continue_puts_and_gets);
}
}
else if (total_connections + failed_connections == expected_connections)
@@ -2921,6 +2937,8 @@
&malicious_put_frequency))
malicious_put_frequency = DEFAULT_MALICIOUS_PUT_FREQUENCY;
+ if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(cfg, "DHT_TESTING",
"MALICIOUS_AFTER_SETTLE"))
+ malicious_after_settle = GNUNET_YES;
/* The normal behavior of the DHT is to do find peer requests
* on its own. Only if this is explicitly turned off should
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-12-21 13:50:48 UTC (rev 13966)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-12-21 13:52:30 UTC (rev 13967)
@@ -4929,6 +4929,10 @@
{
struct PeerInfo *ret;
+ /* Check for connect to self message */
+ if (0 == memcmp(&my_identity, peer, sizeof(struct GNUNET_PeerIdentity)))
+ return;
+
#if DEBUG_DHT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%s:%s Receives core connect message for peer %s distance %d!\n",
@@ -4978,6 +4982,10 @@
struct PeerInfo *to_remove;
int current_bucket;
+ /* Check for disconnect from self message */
+ if (0 == memcmp(&my_identity, peer, sizeof(struct GNUNET_PeerIdentity)))
+ return;
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%s:%s: Received peer disconnect message for peer `%s' from
%s\n",
my_short_id, "DHT", GNUNET_i2s (peer), "CORE");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13967 - gnunet/src/dht,
gnunet <=