[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6665 - GNUnet/src/applications/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6665 - GNUnet/src/applications/testing |
Date: |
Wed, 2 Apr 2008 19:12:03 -0600 (MDT) |
Author: nevans
Date: 2008-04-02 19:12:02 -0600 (Wed, 02 Apr 2008)
New Revision: 6665
Modified:
GNUnet/src/applications/testing/remote.c
GNUnet/src/applications/testing/remotetest.c
GNUnet/src/applications/testing/remotetopologies.c
Log:
Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c 2008-04-02 16:47:23 UTC (rev
6664)
+++ GNUnet/src/applications/testing/remote.c 2008-04-03 01:12:02 UTC (rev
6665)
@@ -89,14 +89,15 @@
int
GNUNET_REMOTE_start_daemons (struct GNUNET_GC_Configuration *newcfg,
- unsigned long long number_of_daemons,
- GNUNET_REMOTE_TOPOLOGIES type_of_topology)
+ unsigned long long number_of_daemons)
{
struct GNUNET_GC_Configuration *basecfg;
struct GNUNET_REMOTE_host_list *array_of_pointers[number_of_daemons];
struct GNUNET_REMOTE_host_list *temp_pos;
+ GNUNET_REMOTE_TOPOLOGIES type_of_topology;
list_as_array = &array_of_pointers[0];
+
char *ssh_username;
char *control_host;
char *remote_config_path;
@@ -104,18 +105,21 @@
char *remote_pid_path;
char *base_config;
char *data_dir;
- unsigned long long starting_port;
- unsigned long long port_increment;
- unsigned long long daemons_per_machine;
- unsigned long long temp_port;
-
char *hostnames;
char *temp;
char *temp_path;
char *temp_pid_file;
char *curr_host;
char *temp_remote_config_path;
+
+ unsigned long long starting_port;
+ unsigned long long port_increment;
+ unsigned long long daemons_per_machine;
+ unsigned long long temp_port;
+ unsigned long long topology;
+
+
unsigned int extra_daemons;
unsigned int count;
unsigned int count_started;
@@ -145,6 +149,10 @@
GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
"SSH_USERNAME", "",
&ssh_username);
+ GNUNET_GC_get_configuration_value_number (newcfg, "MULTIPLE_SERVER_TESTING",
+ "TOPOLOGY",
+ 0, -1, 0, &topology);
+ type_of_topology = (unsigned int)topology;
GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
"CONTROL_HOST", "localhost",
&control_host);
@@ -468,15 +476,19 @@
switch (t)
{
case GNUNET_REMOTE_CLIQUE:
+ fprintf(stderr,"Creating clique topology\n");
ret = GNUNET_REMOTE_connect_clique (head);
break;
case GNUNET_REMOTE_SMALL_WORLD:
+ fprintf(stderr,"Creating small world topology\n");
ret = GNUNET_SYSERR;
break;
case GNUNET_REMOTE_RING:
+ fprintf(stderr,"Creating ring topology\n");
ret = GNUNET_SYSERR;
break;
case GNUNET_REMOTE_2D_TORUS:
+ fprintf(stderr,"Creating 2d torus topology\n");
ret = GNUNET_REMOTE_connect_2d_torus (number_of_daemons, list_as_array);
break;
default:
@@ -530,7 +542,7 @@
* with MANY conns, we'll see...
*/
while (pos != NULL)
- {
+ {
friend_pos = pos->friend_entries;
while (friend_pos != NULL)
{
@@ -545,6 +557,7 @@
}
pos = pos->next;
}
+
}
else
{
Modified: GNUnet/src/applications/testing/remotetest.c
===================================================================
--- GNUnet/src/applications/testing/remotetest.c 2008-04-02 16:47:23 UTC
(rev 6664)
+++ GNUnet/src/applications/testing/remotetest.c 2008-04-03 01:12:02 UTC
(rev 6665)
@@ -77,8 +77,7 @@
return -1;
}
- GNUNET_REMOTE_start_daemons (hostConfig, number_of_daemons,
- GNUNET_REMOTE_CLIQUE);
+ GNUNET_REMOTE_start_daemons (hostConfig, number_of_daemons);
GNUNET_GC_free (hostConfig);
GNUNET_fini (ectx, cfg);
Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c 2008-04-02 16:47:23 UTC
(rev 6664)
+++ GNUnet/src/applications/testing/remotetopologies.c 2008-04-03 01:12:02 UTC
(rev 6665)
@@ -172,12 +172,118 @@
}
int
-GNUNET_REMOTE_connect_2d_torus (int number_of_daemons,
+GNUNET_REMOTE_connect_2d_torus (unsigned int number_of_daemons,
struct GNUNET_REMOTE_host_list
**list_as_array)
{
+ unsigned int i;
+ unsigned int square;
+ unsigned int rows;
+ unsigned int cols;
+ unsigned int toggle = 1;
+ unsigned int nodeToConnect;
+
+ GNUNET_EncName *node1;
+ GNUNET_EncName *node2;
+ struct GNUNET_REMOTE_friends_list *node1temp;
+ struct GNUNET_REMOTE_friends_list *node2temp;
- return GNUNET_SYSERR;
+ node1 = GNUNET_malloc (sizeof (GNUNET_EncName));
+ node2 = GNUNET_malloc (sizeof (GNUNET_EncName));
+
+ square = floor(sqrt(number_of_daemons));
+ rows = square;
+ cols = square;
+
+ if(square * square != number_of_daemons)
+ {
+ while(rows * cols < number_of_daemons)
+ {
+ if (toggle % 2 == 0)
+ rows++;
+ else
+ cols++;
+
+ toggle++;
+ }
+ }
+ fprintf(stderr,_("Connecting nodes in 2d torus topology: %u rows %u
columns\n"),rows,cols);
+ /* Rows and columns are all sorted out, now iterate over all nodes and
connect each
+ * to the node to its right and above. Once this is over, we'll have
our torus!
+ * Special case for the last node (if the rows and columns are not
equal), connect
+ * to the first in the row to maintain topology.
+ */
+ for(i = 0;i<number_of_daemons;i++)
+ {
+ /* First connect to the node to the right */
+ if (((i + 1) % cols != 0) && (i+1 != number_of_daemons))
+ nodeToConnect = i+1;
+ else if (i+1 == number_of_daemons)
+ nodeToConnect = rows * cols - cols;
+ else
+ nodeToConnect = i - cols + 1;
+
+ fprintf(stderr,"connecting node %u to %u\n",i,nodeToConnect);
+ GNUNET_REMOTE_get_daemons_information
(list_as_array[i]->hostname, list_as_array[i]->port,
+
list_as_array[nodeToConnect]->hostname,
+
list_as_array[nodeToConnect]->port, &node1,&node2);
+
+ node1temp = GNUNET_malloc (sizeof (struct
GNUNET_REMOTE_friends_list));
+ node2temp = GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
+
+ node2temp->hostentry = list_as_array[i];
+ node1temp->hostentry = list_as_array[nodeToConnect];
+
+ node1temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
+ node2temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
+
+ memcpy (node1temp->nodeid, node2, sizeof (GNUNET_EncName));
+ memcpy (node2temp->nodeid, node1, sizeof (GNUNET_EncName));
+
+ node1temp->next = list_as_array[i]->friend_entries;
+ node2temp->next = list_as_array[nodeToConnect]->friend_entries;
+
+ list_as_array[i]->friend_entries = node1temp;
+ list_as_array[nodeToConnect]->friend_entries = node2temp;
+
+
+ /* Second connect to the node immediately above */
+ if (i < cols)
+ nodeToConnect = (rows * cols) - cols + i;
+ else
+ nodeToConnect = i - cols;
+
+ if (nodeToConnect < number_of_daemons)
+ {
+ fprintf(stderr,"connecting node %u to
%u\n",i,nodeToConnect);
+ GNUNET_REMOTE_get_daemons_information
(list_as_array[i]->hostname, list_as_array[i]->port,
+
list_as_array[nodeToConnect]->hostname,
+
list_as_array[nodeToConnect]->port, &node1,&node2);
+
+ node1temp = GNUNET_malloc (sizeof (struct
GNUNET_REMOTE_friends_list));
+ node2temp = GNUNET_malloc (sizeof (struct
GNUNET_REMOTE_friends_list));
+
+ node2temp->hostentry = list_as_array[i];
+ node1temp->hostentry = list_as_array[nodeToConnect];
+
+ node1temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
+ node2temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
+
+ memcpy (node1temp->nodeid, node2, sizeof (GNUNET_EncName));
+ memcpy (node2temp->nodeid, node1, sizeof (GNUNET_EncName));
+
+ node1temp->next = list_as_array[i]->friend_entries;
+ node2temp->next = list_as_array[nodeToConnect]->friend_entries;
+
+ list_as_array[i]->friend_entries = node1temp;
+ list_as_array[nodeToConnect]->friend_entries = node2temp;
+ }
+
+ }
+
+ GNUNET_free(node1);
+ GNUNET_free(node2);
+ return GNUNET_OK;
}
int
@@ -322,11 +428,11 @@
GNUNET_snprintf (host, 128, "%s:%u", hostname1, port1);
GNUNET_GC_set_configuration_value_string (cfg1, NULL, "NETWORK", "HOST",
host);
-
+
GNUNET_snprintf (host, 128, "%s:%u", hostname2, port2);
GNUNET_GC_set_configuration_value_string (cfg2, NULL, "NETWORK", "HOST",
host);
-
+
if ((GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg1, 300 * GNUNET_CRON_SECONDS))
&& (GNUNET_OK ==
@@ -368,4 +474,6 @@
return ret;
}
+
+
/* end of remotetopologies.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6665 - GNUnet/src/applications/testing,
gnunet <=