[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24811 - in gnunet: contrib src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24811 - in gnunet: contrib src/mesh |
Date: |
Tue, 6 Nov 2012 19:16:56 +0100 |
Author: szengel
Date: 2012-11-06 19:16:56 +0100 (Tue, 06 Nov 2012)
New Revision: 24811
Modified:
gnunet/contrib/regex_profiler_infiniband.conf
gnunet/src/mesh/gnunet-regex-profiler.c
gnunet/src/mesh/gnunet-service-regexprofiler.c
Log:
Added regex prefix to config for regex profiler.
Modified: gnunet/contrib/regex_profiler_infiniband.conf
===================================================================
--- gnunet/contrib/regex_profiler_infiniband.conf 2012-11-06 16:01:22 UTC
(rev 24810)
+++ gnunet/contrib/regex_profiler_infiniband.conf 2012-11-06 18:16:56 UTC
(rev 24811)
@@ -11,15 +11,17 @@
[regexprofiler]
AUTOSTART = YES
PORT = 12000
-BINARY = /home/szengel/gnunet/src/mesh/gnunet-service-regexprofiler
+BINARY = /home/szengel/gnunet/src/mesh/.libs/gnunet-service-regexprofiler
+REGEX_PREFIX = "GNVPN-0001-PADP"
[mesh]
AUTOSTART = YES
ACCEPT_FROM = 127.0.0.1; 192.168.1.0/24;
-APP_ANNOUNCE_TIME = 10 s
-ID_ANNOUNCE_TIME = 10 s
-CONNECT_TIMEOUT = 10 m
+APP_ANNOUNCE_TIME = 30 s
+ID_ANNOUNCE_TIME = 30 s
+CONNECT_TIMEOUT = 30 s
PORT = 12001
+DHT_REPLICATION_LEVEL = 10
[dht]
AUTOSTART = YES
@@ -28,6 +30,10 @@
HOSTNAME = localhost
DISABLE_TRY_CONNECT = YES
+[dhtcache]
+DATABASE = sqlite
+QUOTA = 10 MB
+
[arm]
DEFAULTSERVICES = core mesh dht statistics regexprofiler
PORT = 12003
@@ -43,7 +49,7 @@
[transport]
AUTOSTART = YES
-PLUGINS = udp
+PLUGINS = tcp
ACCEPT_FROM = 127.0.0.1; 192.168.1.0/24;
ACCEPT_FROM6 = ::1;
NEIGHBOUR_LIMIT = 50
Modified: gnunet/src/mesh/gnunet-regex-profiler.c
===================================================================
--- gnunet/src/mesh/gnunet-regex-profiler.c 2012-11-06 16:01:22 UTC (rev
24810)
+++ gnunet/src/mesh/gnunet-regex-profiler.c 2012-11-06 18:16:56 UTC (rev
24811)
@@ -362,6 +362,20 @@
*/
static unsigned int max_path_compression;
+/**
+ * If we should distribute the search evenly throught all peers (each
+ * peer searches for a string) or if only one peer should search for
+ * all strings.
+ */
+static int no_distributed_search;
+
+/**
+ * Prefix used for regex announcing. We need to prefix the search
+ * strings with it, in order to find something.
+ */
+static char * regex_prefix;
+
+
/******************************************************************************/
/****************************** DECLARATIONS
********************************/
/******************************************************************************/
@@ -641,6 +655,8 @@
return;
}
+ GNUNET_assert (NULL != peer->stats_op_handle);
+
GNUNET_TESTBED_operation_done (peer->stats_op_handle);
peer->stats_op_handle = NULL;
@@ -815,9 +831,6 @@
}
}
- GNUNET_TESTBED_operation_done (peer->mesh_op_handle);
- peer->mesh_op_handle = NULL;
-
peer->stats_op_handle =
GNUNET_TESTBED_service_connect (NULL,
peer->peer_handle,
@@ -828,6 +841,9 @@
&stats_da,
peer);
+ GNUNET_TESTBED_operation_done (peer->mesh_op_handle);
+ peer->mesh_op_handle = NULL;
+
if (peers_found == num_search_strings)
{
prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
@@ -860,6 +876,10 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Found %i of %i strings\n", peers_found, num_search_strings);
+ printf ("Search timed out after %s. Shutting down.\n",
+ GNUNET_STRINGS_relative_time_to_string (search_timeout, GNUNET_NO));
+ fflush (stdout);
+
shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
}
@@ -917,9 +937,9 @@
mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
void *ca_result, const char *emsg)
{
+ struct RegexPeer *peer = (struct RegexPeer *) cls;
static unsigned int peer_cnt;
unsigned int next_p;
- struct RegexPeer *peer = (struct RegexPeer *) cls;
if (NULL != emsg || NULL == op || NULL == ca_result)
{
@@ -944,9 +964,12 @@
GNUNET_MESH_peer_request_connect_by_string (peer->mesh_tunnel_handle,
peer->search_str);
- if (peer_cnt < num_search_strings)
+ if (peer_cnt < (num_search_strings - 1))
{
- next_p = ((++peer_cnt) % num_peers);
+ if (GNUNET_YES == no_distributed_search)
+ next_p = 0;
+ else
+ next_p = (++peer_cnt % num_peers);
peers[next_p].search_str = search_strings[next_p];
peers[next_p].search_str_matched = GNUNET_NO;
@@ -1607,8 +1630,8 @@
offset = 0;
for (i = 0; i < str_cnt; i++)
{
- (*strings)[i] = GNUNET_strdup (&data[offset]);
- offset += strlen ((*strings)[i]) + 1;
+ GNUNET_asprintf (&(*strings)[i], "%s%s", regex_prefix, &data[offset]);
+ offset += strlen (&data[offset]) + 1;
}
free (data);
return str_cnt;
@@ -1667,6 +1690,16 @@
shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
return;
}
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (config, "REGEXPROFILER",
"REGEX_PREFIX",
+ ®ex_prefix))
+ {
+ fprintf (stderr, _("Configuration option (regex_prefix) missing.
Exiting\n"));
+ shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+ return;
+ }
+
if ( (NULL != data_filename) &&
(NULL == (data_file =
GNUNET_DISK_file_open (data_filename,
@@ -1752,6 +1785,9 @@
{'p', "max-path-compression", "MAX_PATH_COMPRESSION",
gettext_noop ("maximum path compression length"),
1, &GNUNET_GETOPT_set_uint, &max_path_compression},
+ {'i', "no-distributed-search", "",
+ gettext_noop ("if this option is set, only one peer is responsible for
searching all strings"),
+ 0, &GNUNET_GETOPT_set_one, &no_distributed_search},
GNUNET_GETOPT_OPTION_END
};
int ret;
Modified: gnunet/src/mesh/gnunet-service-regexprofiler.c
===================================================================
--- gnunet/src/mesh/gnunet-service-regexprofiler.c 2012-11-06 16:01:22 UTC
(rev 24810)
+++ gnunet/src/mesh/gnunet-service-regexprofiler.c 2012-11-06 18:16:56 UTC
(rev 24811)
@@ -66,7 +66,12 @@
*/
static char * policy_filename;
+/**
+ * Prefix to add before every regex we're announcing.
+ */
+static char * regex_prefix;
+
/**
* Task run during shutdown.
*
@@ -166,6 +171,19 @@
return;
}
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg, "REGEXPROFILER",
"REGEX_PREFIX",
+ ®ex_prefix))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _
+ ("%s service is lacking key configuration settings (%s).
Exiting.\n"),
+ "regexprofiler", "regex_prefix");
+ global_ret = GNUNET_SYSERR;
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+
stats_handle = GNUNET_STATISTICS_create ("regexprofiler", cfg);
app = (GNUNET_MESH_ApplicationType)0;
@@ -212,9 +230,10 @@
if (((data[offset] == '\n')) && (buf != &data[offset]))
{
data[offset] = '\0';
- regex = buf;
- GNUNET_assert (NULL != regex);
+ GNUNET_assert (NULL != buf);
+ GNUNET_asprintf (®ex, "%s%s", regex_prefix, buf);
announce_regex (regex);
+ GNUNET_free (regex);
buf = &data[offset + 1];
}
else if ((data[offset] == '\n') || (data[offset] == '\0'))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24811 - in gnunet: contrib src/mesh,
gnunet <=