[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8142 - GNUnet/src/applications/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8142 - GNUnet/src/applications/testing |
Date: |
Tue, 20 Jan 2009 15:54:35 -0700 (MST) |
Author: nevans
Date: 2009-01-20 15:54:35 -0700 (Tue, 20 Jan 2009)
New Revision: 8142
Modified:
GNUnet/src/applications/testing/remote.c
GNUnet/src/applications/testing/remote.h
GNUnet/src/applications/testing/remotetest.c
GNUnet/src/applications/testing/remotetopologies.c
Log:
pre-commit
Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c 2009-01-20 22:54:23 UTC (rev
8141)
+++ GNUnet/src/applications/testing/remote.c 2009-01-20 22:54:35 UTC (rev
8142)
@@ -71,8 +71,8 @@
GNUNET_free (cmd);
length =
- snprintf (NULL, 0, "ssh address@hidden %sgnunet-update -c %s%s", username,
hostname,
- gnunetd_home, remote_config_path, configFileName);
+ snprintf (NULL, 0, "ssh address@hidden %sgnunet-update -c %s%s", username,
+ hostname, gnunetd_home, remote_config_path, configFileName);
cmd = GNUNET_malloc (length + 1);
snprintf (cmd, length + 1, "ssh address@hidden %sgnunet-update -c %s%s",
username,
hostname, gnunetd_home, remote_config_path, configFileName);
@@ -80,7 +80,7 @@
fprintf (stderr, _("ssh command is : %s \n"), cmd);
system (cmd);
- GNUNET_free (cmd);
+ GNUNET_free (cmd);
length =
snprintf (NULL, 0, "ssh address@hidden %sgnunetd -c %s%s", username,
hostname,
@@ -167,9 +167,9 @@
type_of_topology = (unsigned int) topology;
GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
- "PERCENTAGE", "1.0",
- &percentage_string);
- percentage = atof(percentage_string);
+ "PERCENTAGE", "1.0",
+ &percentage_string);
+ percentage = atof (percentage_string);
GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
"CONTROL_HOST", "localhost",
@@ -180,18 +180,18 @@
&hostnames);
GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
- "DOT_OUTPUT", "",
- &dotOutFileName);
+ "DOT_OUTPUT", "",
+ &dotOutFileName);
dotOutFile = NULL;
- if (strcmp(dotOutFileName,"") != 0)
- {
- dotOutFile = FOPEN (dotOutFileName,"w");
- if (dotOutFile != NULL)
- {
- fprintf(dotOutFile, "strict graph G {\n");
- }
- }
+ if (strcmp (dotOutFileName, "") != 0)
+ {
+ dotOutFile = FOPEN (dotOutFileName, "w");
+ if (dotOutFile != NULL)
+ {
+ fprintf (dotOutFile, "strict graph G {\n");
+ }
+ }
GNUNET_GC_get_configuration_value_number (newcfg, "MULTIPLE_SERVER_TESTING",
"STARTING_PORT",
@@ -479,12 +479,14 @@
GNUNET_GC_free (basecfg);
++i;
}
- ret = GNUNET_REMOTE_create_topology (type_of_topology, number_of_daemons,
dotOutFile, percentage);
+ ret =
+ GNUNET_REMOTE_create_topology (type_of_topology, number_of_daemons,
+ dotOutFile, percentage);
if (dotOutFile != NULL)
- {
- fprintf(dotOutFile,"}\n");
- fclose(dotOutFile);
- }
+ {
+ fprintf (dotOutFile, "}\n");
+ fclose (dotOutFile);
+ }
GNUNET_free (dotOutFileName);
GNUNET_free (percentage_string);
@@ -502,7 +504,8 @@
int
GNUNET_REMOTE_create_topology (GNUNET_REMOTE_TOPOLOGIES type,
- int number_of_daemons, FILE *dotOutFile, double
percentage)
+ int number_of_daemons, FILE * dotOutFile,
+ double percentage)
{
FILE *temp_friend_handle;
int ret;
@@ -529,7 +532,9 @@
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,
dotOutFile);
+ ret =
+ GNUNET_REMOTE_connect_2d_torus (number_of_daemons, list_as_array,
+ dotOutFile);
break;
case GNUNET_REMOTE_ERDOS_RENYI:
fprintf (stderr, "Creating Erdos-Renyi topology\n");
@@ -585,7 +590,7 @@
* to the first later, but this IS simple. If performance becomes a
problem
* with MANY conns, we'll see...
*/
- while (pos != NULL)
+ while ((pos != NULL) && (ret == GNUNET_OK))
{
friend_pos = pos->friend_entries;
while (friend_pos != NULL)
@@ -594,9 +599,13 @@
pos->hostname, pos->port,
friend_pos->hostentry->hostname,
friend_pos->hostentry->port);
- GNUNET_REMOTE_connect_daemons (pos->hostname, pos->port,
- friend_pos->hostentry->hostname,
- friend_pos->hostentry->port,
dotOutFile);
+ ret = GNUNET_REMOTE_connect_daemons (pos->hostname, pos->port,
+ friend_pos->hostentry->
+ hostname,
+ friend_pos->hostentry->
+ port, dotOutFile);
+ if (ret != GNUNET_OK)
+ break;
friend_pos = friend_pos->next;
}
pos = pos->next;
Modified: GNUnet/src/applications/testing/remote.h
===================================================================
--- GNUnet/src/applications/testing/remote.h 2009-01-20 22:54:23 UTC (rev
8141)
+++ GNUnet/src/applications/testing/remote.h 2009-01-20 22:54:35 UTC (rev
8142)
@@ -68,7 +68,8 @@
*/
int
GNUNET_REMOTE_connect_daemons (char *hostname1, unsigned short port1,
- char *hostname2, unsigned short port2, FILE
*dotOutFile);
+ char *hostname2, unsigned short port2,
+ FILE * dotOutFile);
/**
* Because we need to copy over the friends file before actually connecting,
@@ -94,7 +95,8 @@
*/
int
GNUNET_REMOTE_create_topology (GNUNET_REMOTE_TOPOLOGIES type,
- int number_of_daemons, FILE *dotOufFile, double
percentage);
+ int number_of_daemons, FILE * dotOufFile,
+ double percentage);
#endif /*REMOTE_H_ */
Modified: GNUnet/src/applications/testing/remotetest.c
===================================================================
--- GNUnet/src/applications/testing/remotetest.c 2009-01-20 22:54:23 UTC
(rev 8141)
+++ GNUnet/src/applications/testing/remotetest.c 2009-01-20 22:54:35 UTC
(rev 8142)
@@ -43,10 +43,11 @@
{'n', "number_of_daemons", "NUMBER_OF_DAEMONS",
gettext_noop ("set number of daemons to start"),
1, &GNUNET_getopt_configure_set_ulong, &number_of_daemons}, /* -n */
- GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
+ GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
{'O', "output", "DOT_OUTPUT",
- gettext_noop ("set output file for a dot input file which represents
the graph of the connected nodes"),
- 1, &GNUNET_getopt_configure_set_string, &dotOutFileName},
+ gettext_noop
+ ("set output file for a dot input file which represents the graph of the
connected nodes"),
+ 1, &GNUNET_getopt_configure_set_string, &dotOutFileName},
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
@@ -79,12 +80,11 @@
}
if (dotOutFileName != NULL)
- {
- GNUNET_GC_set_configuration_value_string (hostConfig, NULL,
-
"MULTIPLE_SERVER_TESTING",
- "DOT_OUTPUT",
- dotOutFileName);
- }
+ {
+ GNUNET_GC_set_configuration_value_string (hostConfig, NULL,
+ "MULTIPLE_SERVER_TESTING",
+ "DOT_OUTPUT", dotOutFileName);
+ }
GNUNET_REMOTE_start_daemons (hostConfig, number_of_daemons);
Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c 2009-01-20 22:54:23 UTC
(rev 8141)
+++ GNUnet/src/applications/testing/remotetopologies.c 2009-01-20 22:54:35 UTC
(rev 8142)
@@ -44,10 +44,12 @@
}
int
-GNUNET_REMOTE_connect_erdos_renyi (double probability, struct
GNUNET_REMOTE_host_list *main_list, FILE *dotOutFile)
+GNUNET_REMOTE_connect_erdos_renyi (double probability,
+ struct GNUNET_REMOTE_host_list *main_list,
+ FILE * dotOutFile)
{
double temp_rand;
- struct GNUNET_REMOTE_host_list *pos = main_list;
+ struct GNUNET_REMOTE_host_list *pos = main_list;
struct GNUNET_REMOTE_host_list *iter_pos = main_list;
GNUNET_EncName *node1;
GNUNET_EncName *node2;
@@ -69,29 +71,31 @@
iter_pos->port, &node1,
&node2))
{
- temp_rand = RANDOM ();
- if (temp_rand <
probability)
- {
-
node1temp =
-
GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
-
node2temp =
-
GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
+ temp_rand = RANDOM ();
+ if (temp_rand < probability)
+ {
+ node1temp =
+ GNUNET_malloc (sizeof
+ (struct GNUNET_REMOTE_friends_list));
+ node2temp =
+ GNUNET_malloc (sizeof
+ (struct GNUNET_REMOTE_friends_list));
-
node2temp->hostentry = pos;
-
node1temp->hostentry = iter_pos;
+ node2temp->hostentry = pos;
+ node1temp->hostentry = iter_pos;
-
node1temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
-
node2temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
+ 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));
+ memcpy (node1temp->nodeid, node2, sizeof (GNUNET_EncName));
+ memcpy (node2temp->nodeid, node1, sizeof (GNUNET_EncName));
-
node1temp->next = pos->friend_entries;
-
node2temp->next = iter_pos->friend_entries;
+ node1temp->next = pos->friend_entries;
+ node2temp->next = iter_pos->friend_entries;
-
pos->friend_entries = node1temp;
-
iter_pos->friend_entries = node2temp;
- }
+ pos->friend_entries = node1temp;
+ iter_pos->friend_entries = node2temp;
+ }
}
iter_pos = iter_pos->next;
}
@@ -105,7 +109,8 @@
}
int
-GNUNET_REMOTE_connect_clique (struct GNUNET_REMOTE_host_list *main_list, FILE
*dotOutFile)
+GNUNET_REMOTE_connect_clique (struct GNUNET_REMOTE_host_list *main_list,
+ FILE * dotOutFile)
{
struct GNUNET_REMOTE_host_list *pos = main_list;
struct GNUNET_REMOTE_host_list *iter_pos = main_list;
@@ -160,7 +165,8 @@
}
int
-GNUNET_REMOTE_connect_ring (struct GNUNET_REMOTE_host_list *main_list, FILE
*dotOutFile)
+GNUNET_REMOTE_connect_ring (struct GNUNET_REMOTE_host_list *main_list,
+ FILE * dotOutFile)
{
struct GNUNET_REMOTE_host_list *pos = main_list;
struct GNUNET_REMOTE_host_list *iter_pos = main_list;
@@ -237,7 +243,7 @@
int
GNUNET_REMOTE_connect_2d_torus (unsigned int number_of_daemons,
struct GNUNET_REMOTE_host_list
- **list_as_array, FILE *dotOutFile)
+ **list_as_array, FILE * dotOutFile)
{
unsigned int i;
unsigned int square;
@@ -364,7 +370,7 @@
int
GNUNET_REMOTE_connect_small_world (int number_of_daemons,
struct GNUNET_REMOTE_host_list
- **list_as_array, FILE *dotOutFile)
+ **list_as_array, FILE * dotOutFile)
{
return GNUNET_SYSERR;
@@ -382,7 +388,8 @@
int
GNUNET_REMOTE_connect_daemons (char *hostname1, unsigned short port1,
- char *hostname2, unsigned short port2, FILE
*dotOutFile)
+ char *hostname2, unsigned short port2,
+ FILE * dotOutFile)
{
char host[128];
char *buf;
@@ -480,14 +487,14 @@
}
if (dotOutFile != NULL)
- {
- buf = GNUNET_malloc(18);
- snprintf(buf, 7, "\tn%s", (char *)host1entry);
- snprintf(&buf[6], 5," -- ");
- snprintf(&buf[10], 6, "n%s", (char *)host2entry);
- fprintf(dotOutFile, "%s;\n", buf);
- GNUNET_free(buf);
- }
+ {
+ buf = GNUNET_malloc (18);
+ snprintf (buf, 7, "\tn%s", (char *) host1entry);
+ snprintf (&buf[6], 5, " -- ");
+ snprintf (&buf[10], 6, "n%s", (char *) host2entry);
+ fprintf (dotOutFile, "%s;\n", buf);
+ GNUNET_free (buf);
+ }
fprintf (stderr, "%s\n", ret == GNUNET_OK ? "Connected nodes." : "?");
GNUNET_client_connection_destroy (sock1);
GNUNET_client_connection_destroy (sock2);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8142 - GNUnet/src/applications/testing,
gnunet <=