[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25965 - gnunet/src/regex
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25965 - gnunet/src/regex |
Date: |
Thu, 31 Jan 2013 13:46:07 +0100 |
Author: bartpolot
Date: 2013-01-31 13:46:07 +0100 (Thu, 31 Jan 2013)
New Revision: 25965
Modified:
gnunet/src/regex/gnunet-regex-profiler.c
Log:
- slow down the searching of strings to avoid collapsing the testbed
Modified: gnunet/src/regex/gnunet-regex-profiler.c
===================================================================
--- gnunet/src/regex/gnunet-regex-profiler.c 2013-01-31 12:32:20 UTC (rev
25964)
+++ gnunet/src/regex/gnunet-regex-profiler.c 2013-01-31 12:46:07 UTC (rev
25965)
@@ -946,7 +946,39 @@
&do_connect_by_string_timeout, NULL);
}
+/**
+ * Start searching for the next string in the DHT.
+ *
+ * @param cls Index of the next peer in the peers array.
+ * @param tc TaskContext.
+ */
+void
+find_next_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ long next_p = (long) cls;
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+ return;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Searching for string \"%s\" on peer %d with file %s\n",
+ peers[next_p].search_str, next_p, peers[next_p].policy_file);
+
+ /* FIXME
+ * dont connect to a new dht for each peer, we might want to seach for n
+ * strings on m peers where n > m
+ */
+ peers[next_p].dht_op_handle =
+ GNUNET_TESTBED_service_connect (NULL,
+ peers[next_p].peer_handle,
+ "dht",
+ &dht_connect_cb,
+ &peers[next_p],
+ &dht_ca,
+ &dht_da,
+ &peers[next_p]);
+}
+
/**
* DHT connect callback. Called when we are connected to the dht service for
* the peer in 'cls'. If successfull we connect to the stats service of this
@@ -992,23 +1024,11 @@
peers[next_p].search_str = search_strings[next_p];
peers[next_p].search_str_matched = GNUNET_NO;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Searching for string \"%s\" on peer %d with file %s\n",
- peers[next_p].search_str, next_p, peers[next_p].policy_file);
-
- /* FIXME
- * dont connect to a new dht for each peer, we might want to seach for n
- * strings on m peers where n > m
- */
- peers[next_p].dht_op_handle =
- GNUNET_TESTBED_service_connect (NULL,
- peers[next_p].peer_handle,
- "dht",
- &dht_connect_cb,
- &peers[next_p],
- &dht_ca,
- &dht_da,
- &peers[next_p]);
+ /* Don't start all searches at once */
+ /* TODO add some intelligence to the timeout */
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &find_next_string,
+ (void *) (long) next_p);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25965 - gnunet/src/regex,
gnunet <=