[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6630 - in GNUnet/src: applications/testing applications/to
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6630 - in GNUnet/src: applications/testing applications/topology_default include util/network_client |
Date: |
Wed, 26 Mar 2008 18:49:26 -0600 (MDT) |
Author: nevans
Date: 2008-03-26 18:49:25 -0600 (Wed, 26 Mar 2008)
New Revision: 6630
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
GNUnet/src/applications/topology_default/topology.c
GNUnet/src/include/gnunet_remote_lib.h
GNUnet/src/util/network_client/tcpio.c
Log:
fixed, and ran pre-commit
Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c 2008-03-27 00:20:32 UTC (rev
6629)
+++ GNUnet/src/applications/testing/remote.c 2008-03-27 00:49:25 UTC (rev
6630)
@@ -53,7 +53,7 @@
GNUNET_REMOTE_start_daemon (char *gnunetd_home,
char *localConfigPath, char *configFileName,
char *remote_config_path, char *hostname,
- char *username,char *remote_friend_file_path)
+ char *username, char *remote_friend_file_path)
{
char *cmd;
int length;
@@ -69,19 +69,7 @@
system (cmd);
GNUNET_free (cmd);
- length =
- snprintf (NULL, 0, "ssh address@hidden touch %s", username, hostname,
- remote_friend_file_path);
- cmd = GNUNET_malloc (length + 1);
- snprintf (cmd, length + 1, "ssh address@hidden touch %s", username, hostname,
- remote_friend_file_path);
- fprintf (stderr, "ssh command is : %s \n", cmd);
-
- system (cmd);
-
- GNUNET_free (cmd);
-
length =
snprintf (NULL, 0, "ssh address@hidden %sgnunetd -c %s%s", username,
hostname,
gnunetd_home, remote_config_path, configFileName);
@@ -94,14 +82,15 @@
system (cmd);
GNUNET_free (cmd);
-
-
+
+
return GNUNET_OK;
}
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,
+ GNUNET_REMOTE_TOPOLOGIES type_of_topology)
{
struct GNUNET_GC_Configuration *basecfg;
struct GNUNET_REMOTE_host_list *array_of_pointers[number_of_daemons];
@@ -297,18 +286,23 @@
GNUNET_malloc (sizeof (struct GNUNET_REMOTE_host_list));
temp_pos->hostname = GNUNET_malloc (strlen (curr_host));
strcpy (temp_pos->hostname, curr_host);
-
- temp_pos->username = GNUNET_malloc(strlen(ssh_username));
- strcpy (temp_pos->username,ssh_username);
- friend_location_length =
snprintf(NULL,0,"%s/friends",temp_remote_config_path);
- temp_pos->remote_friend_file_path =
GNUNET_malloc(friend_location_length + 1);
-
snprintf(temp_pos->remote_friend_file_path,friend_location_length +
1,"%s/friends",temp_remote_config_path);
-
+ temp_pos->username = GNUNET_malloc (strlen (ssh_username));
+ strcpy (temp_pos->username, ssh_username);
+
+ friend_location_length =
+ snprintf (NULL, 0, "%s/friends", temp_remote_config_path);
+ temp_pos->remote_friend_file_path =
+ GNUNET_malloc (friend_location_length + 1);
+ snprintf (temp_pos->remote_friend_file_path,
+ friend_location_length + 1, "%s/friends",
+ temp_remote_config_path);
+
GNUNET_REMOTE_start_daemon (remote_gnunetd_path, "/tmp/",
temp, remote_config_path,
- curr_host,
ssh_username,temp_pos->remote_friend_file_path);
-
+ curr_host, ssh_username,
+ temp_pos->remote_friend_file_path);
+
GNUNET_GC_get_configuration_value_number (basecfg,
"NETWORK",
"PORT",
@@ -319,7 +313,7 @@
array_of_pointers[count_started] = temp_pos;
count_started++;
}
-
+
GNUNET_free (temp_remote_config_path);
GNUNET_free (temp);
UNLINK (temp_path);
@@ -338,21 +332,22 @@
"PIDFILE",
temp_pid_file);
GNUNET_free (temp_pid_file);
-
+
temp_remote_config_path_length =
- snprintf (NULL, 0, "%s%d", remote_config_path, j);
- temp_remote_config_path =
- GNUNET_malloc (temp_remote_config_path_length + 1);
- snprintf (temp_remote_config_path,
- temp_remote_config_path_length + 1, "%s%d",
- remote_config_path, j);
+ snprintf (NULL, 0, "%s%d", remote_config_path, j);
+ temp_remote_config_path =
+ GNUNET_malloc (temp_remote_config_path_length + 1);
+ snprintf (temp_remote_config_path,
+ temp_remote_config_path_length + 1, "%s%d",
+ remote_config_path, j);
- GNUNET_GC_set_configuration_value_string (basecfg,
NULL, "PATHS",
- "GNUNETD_HOME",
- temp_remote_config_path);
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "PATHS",
+ "GNUNETD_HOME",
+
temp_remote_config_path);
-
+
GNUNET_GC_set_configuration_value_number (basecfg, NULL,
"NETWORK", "PORT",
starting_port +
@@ -404,18 +399,24 @@
GNUNET_malloc (sizeof (struct GNUNET_REMOTE_host_list));
temp_pos->hostname = GNUNET_malloc (strlen (curr_host));
strcpy (temp_pos->hostname, curr_host);
-
- temp_pos->username =
GNUNET_malloc(strlen(ssh_username));
- strcpy (temp_pos->username,ssh_username);
- friend_location_length =
snprintf(NULL,0,"%s/friends",temp_remote_config_path);
- temp_pos->remote_friend_file_path =
GNUNET_malloc(friend_location_length + 1);
-
snprintf(temp_pos->remote_friend_file_path,friend_location_length +
1,"%s/friends",temp_remote_config_path);
-
+ temp_pos->username = GNUNET_malloc (strlen (ssh_username));
+ strcpy (temp_pos->username, ssh_username);
+
+ friend_location_length =
+ snprintf (NULL, 0, "%s/friends", temp_remote_config_path);
+ temp_pos->remote_friend_file_path =
+ GNUNET_malloc (friend_location_length + 1);
+ snprintf (temp_pos->remote_friend_file_path,
+ friend_location_length + 1, "%s/friends",
+ temp_remote_config_path);
+
GNUNET_REMOTE_start_daemon (remote_gnunetd_path, "/tmp/",
- temp, remote_config_path,
- curr_host,
ssh_username,temp_pos->remote_friend_file_path);
-
+ temp, remote_config_path,
+ curr_host, ssh_username,
+ temp_pos->
+ remote_friend_file_path);
+
GNUNET_GC_get_configuration_value_number (basecfg,
"NETWORK",
"PORT",
@@ -436,9 +437,8 @@
GNUNET_GC_free (basecfg);
++i;
}
- ret =
- GNUNET_REMOTE_create_topology (type_of_topology, number_of_daemons);
-
+ ret = GNUNET_REMOTE_create_topology (type_of_topology, number_of_daemons);
+
GNUNET_free (base_config);
GNUNET_free (remote_pid_path);
GNUNET_free (data_dir);
@@ -455,14 +455,14 @@
GNUNET_REMOTE_create_topology (GNUNET_REMOTE_TOPOLOGIES t,
int number_of_daemons)
{
- FILE *temp_friend_handle;
+ FILE *temp_friend_handle;
int ret;
struct GNUNET_REMOTE_host_list *pos;
struct GNUNET_REMOTE_friends_list *friend_pos;
-
+
char *cmd;
int length;
-
+
ret = GNUNET_OK;
switch (t)
{
@@ -470,51 +470,59 @@
ret = GNUNET_REMOTE_connect_clique (head);
break;
case GNUNET_REMOTE_SMALL_WORLD:
- ret = GNUNET_SYSERR;
+ ret = GNUNET_SYSERR;
break;
case GNUNET_REMOTE_RING:
- ret = GNUNET_SYSERR;
+ ret = GNUNET_SYSERR;
break;
case GNUNET_REMOTE_2D_TORUS:
ret = GNUNET_REMOTE_connect_2d_torus (number_of_daemons, list_as_array);
break;
default:
- ret = GNUNET_SYSERR;
+ ret = GNUNET_SYSERR;
break;
}
-
- if(ret == GNUNET_OK)
- {
- pos = head;
- while(pos != NULL)
- {
- fprintf(stderr,"Friend list of
%s:%lld\n",pos->hostname,pos->port);
- temp_friend_handle = fopen ("friend.temp", "wt");
- friend_pos = pos->friend_entries;
- while(friend_pos != NULL)
- {
- fprintf(stderr,"\t%s\n",(const char
*)friend_pos->nodeid);
- fprintf(temp_friend_handle,"%s\n",(const char
*)friend_pos->nodeid);
- friend_pos = friend_pos->next;
- }
-
- fclose(temp_friend_handle);
- length = snprintf (NULL, 0, "scp %s address@hidden:%s",
"friend.temp", pos->username, pos->hostname, pos->remote_friend_file_path);
- cmd = GNUNET_malloc (length + 1);
- snprintf (cmd, length + 1, "scp %s address@hidden:%s",
"friend.temp", pos->username, pos->hostname, pos->remote_friend_file_path);
- fprintf (stderr, "scp command for friend file copy is :
%s \n", cmd);
- system (cmd);
-
- pos = pos->next;
- }
-
- system("rm friend.temp");
- }
- else
- {
- fprintf(stderr,"connect didn't return well!\n");
- }
+ if (ret == GNUNET_OK)
+ {
+ pos = head;
+ while (pos != NULL)
+ {
+ fprintf (stderr, "Friend list of %s:%lld\n", pos->hostname,
+ pos->port);
+ temp_friend_handle = fopen ("friend.temp", "wt");
+ friend_pos = pos->friend_entries;
+ while (friend_pos != NULL)
+ {
+ fprintf (stderr, "\t%s\n", (const char *) friend_pos->nodeid);
+ fprintf (temp_friend_handle, "%s\n",
+ (const char *) friend_pos->nodeid);
+ friend_pos = friend_pos->next;
+ }
+
+ fclose (temp_friend_handle);
+ length =
+ snprintf (NULL, 0, "scp %s address@hidden:%s", "friend.temp",
+ pos->username, pos->hostname,
+ pos->remote_friend_file_path);
+ cmd = GNUNET_malloc (length + 1);
+ snprintf (cmd, length + 1, "scp %s address@hidden:%s", "friend.temp",
+ pos->username, pos->hostname,
+ pos->remote_friend_file_path);
+
+ fprintf (stderr, "scp command for friend file copy is : %s \n",
+ cmd);
+ system (cmd);
+
+ pos = pos->next;
+ }
+
+ system ("rm friend.temp");
+ }
+ else
+ {
+ fprintf (stderr, "connect didn't return well!\n");
+ }
return ret;
}
Modified: GNUnet/src/applications/testing/remote.h
===================================================================
--- GNUnet/src/applications/testing/remote.h 2008-03-27 00:20:32 UTC (rev
6629)
+++ GNUnet/src/applications/testing/remote.h 2008-03-27 00:49:25 UTC (rev
6630)
@@ -46,10 +46,12 @@
int
GNUNET_REMOTE_connect_daemons (char *ip1, unsigned short port1, char *ip2,
unsigned short port2);
-
+
int
GNUNET_REMOTE_get_daemons_information (char *hostname1, unsigned short port1,
- char *hostname2, unsigned short port2,
GNUNET_EncName **host1entry, GNUNET_EncName **host2entry);
+ char *hostname2, unsigned short port2,
+ GNUNET_EncName ** host1entry,
+ GNUNET_EncName ** host2entry);
/**
* Create a topology (connect the running gnunetd's) that corresponds
Modified: GNUnet/src/applications/testing/remotetest.c
===================================================================
--- GNUnet/src/applications/testing/remotetest.c 2008-03-27 00:20:32 UTC
(rev 6629)
+++ GNUnet/src/applications/testing/remotetest.c 2008-03-27 00:49:25 UTC
(rev 6630)
@@ -78,7 +78,8 @@
return -1;
}
- GNUNET_REMOTE_start_daemons (hostConfig, number_of_daemons,
GNUNET_REMOTE_CLIQUE);
+ GNUNET_REMOTE_start_daemons (hostConfig, number_of_daemons,
+ GNUNET_REMOTE_CLIQUE);
GNUNET_GC_free (hostConfig);
GNUNET_fini (ectx, cfg);
Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c 2008-03-27 00:20:32 UTC
(rev 6629)
+++ GNUnet/src/applications/testing/remotetopologies.c 2008-03-27 00:49:25 UTC
(rev 6630)
@@ -51,42 +51,47 @@
struct GNUNET_REMOTE_friends_list *node1temp;
struct GNUNET_REMOTE_friends_list *node2temp;
- node1 = GNUNET_malloc(sizeof(GNUNET_EncName));
- node2 = GNUNET_malloc(sizeof(GNUNET_EncName));
+ node1 = GNUNET_malloc (sizeof (GNUNET_EncName));
+ node2 = GNUNET_malloc (sizeof (GNUNET_EncName));
while ((pos != NULL) && (pos->next != NULL))
{
iter_pos = pos->next;
while (iter_pos != NULL)
{
-
- fprintf(stderr,"connecting %s:%lld to
%s:%lld\n",pos->hostname,pos->port,iter_pos->hostname,iter_pos->port);
- if(GNUNET_OK == GNUNET_REMOTE_get_daemons_information
(pos->hostname, pos->port,
- iter_pos->hostname,
iter_pos->port,&node1,&node2))
- {
- node1temp = GNUNET_malloc(sizeof(struct
GNUNET_REMOTE_friends_list));
- node2temp = GNUNET_malloc(sizeof(struct
GNUNET_REMOTE_friends_list));
-
- 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 = pos->friend_entries;
- node2temp->next = iter_pos->friend_entries;
-
- pos->friend_entries = node1temp;
- iter_pos->friend_entries = node2temp;
- }
+ if (GNUNET_OK ==
+ GNUNET_REMOTE_get_daemons_information (pos->hostname, pos->port,
+ iter_pos->hostname,
+ iter_pos->port, &node1,
+ &node2))
+ {
+ fprintf (stderr, "node1's id is %s\n", (const char *) node1);
+ fprintf (stderr, "node2's id is %s\n", (const char *) node2);
+ node1temp =
+ GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
+ node2temp =
+ GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
+
+ 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 = pos->friend_entries;
+ node2temp->next = iter_pos->friend_entries;
+
+ pos->friend_entries = node1temp;
+ iter_pos->friend_entries = node2temp;
+ }
iter_pos = iter_pos->next;
}
pos = pos->next;
}
-
- GNUNET_free(node1);
- GNUNET_free(node2);
-
+
+ GNUNET_free (node1);
+ GNUNET_free (node2);
+
return GNUNET_OK;
}
@@ -119,12 +124,12 @@
struct GNUNET_ClientServerConnection *sock1;
struct GNUNET_ClientServerConnection *sock2;
int ret;
-
+
GNUNET_EncName *host1entry;
GNUNET_EncName *host2entry;
- host1entry = GNUNET_malloc(sizeof(GNUNET_EncName));
- host2entry = GNUNET_malloc(sizeof(GNUNET_EncName));
-
+ host1entry = GNUNET_malloc (sizeof (GNUNET_EncName));
+ host2entry = GNUNET_malloc (sizeof (GNUNET_EncName));
+
GNUNET_MessageHello *h1;
GNUNET_MessageHello *h2;
@@ -184,17 +189,19 @@
GNUNET_free_non_null (h2);
}
- GNUNET_hash_to_enc (&h1->senderIdentity.hashPubKey, host1entry);
+ GNUNET_hash_to_enc (&h1->senderIdentity.hashPubKey, host1entry);
GNUNET_hash_to_enc (&h2->senderIdentity.hashPubKey, host2entry);
-
+
if (ret != GNUNET_OK)
{
fprintf (stderr,
"\nFailed to connect `%s' and `%s'\n",
(const char *) &host1entry, (const char *) &host2entry);
- fprintf (stderr, "Connections of `%s':\n", (const char *)
&host1entry);
+ fprintf (stderr, "Connections of `%s':\n",
+ (const char *) &host1entry);
GNUNET_IDENTITY_request_peer_infos (sock1, &printInfo, NULL);
- fprintf (stderr, "Connections of `%s':\n", (const char *)
&host2entry);
+ fprintf (stderr, "Connections of `%s':\n",
+ (const char *) &host2entry);
GNUNET_IDENTITY_request_peer_infos (sock2, &printInfo, NULL);
}
@@ -213,9 +220,11 @@
int
GNUNET_REMOTE_get_daemons_information (char *hostname1, unsigned short port1,
- char *hostname2, unsigned short port2,
GNUNET_EncName **host1entry, GNUNET_EncName **host2entry)
+ char *hostname2, unsigned short port2,
+ GNUNET_EncName ** host1entry,
+ GNUNET_EncName ** host2entry)
{
- char host[128];
+ char host[128];
struct GNUNET_GC_Configuration *cfg1 = GNUNET_GC_create ();
struct GNUNET_GC_Configuration *cfg2 = GNUNET_GC_create ();
struct GNUNET_ClientServerConnection *sock1;
@@ -242,24 +251,26 @@
sock1 = GNUNET_client_connection_create (NULL, cfg1);
sock2 = GNUNET_client_connection_create (NULL, cfg2);
ret = -20;
- fprintf (stderr, _("Waiting for peers to connect"));
while ((ret++ < -1) && (GNUNET_shutdown_test () == GNUNET_NO))
{
h1 = NULL;
h2 = NULL;
- GNUNET_IDENTITY_get_self (sock1,&h1);
- GNUNET_IDENTITY_get_self (sock2,&h2);
-
+ if ((GNUNET_OK == GNUNET_IDENTITY_get_self (sock1, &h1))
+ && (GNUNET_OK == GNUNET_IDENTITY_get_self (sock2, &h2)))
+ {
+ ret = GNUNET_OK;
+ break;
+ }
+
GNUNET_thread_sleep (100 * GNUNET_CRON_MILLISECONDS);
- }
+ }
- GNUNET_hash_to_enc (&h1->senderIdentity.hashPubKey, *host1entry);
+ GNUNET_hash_to_enc (&h1->senderIdentity.hashPubKey, *host1entry);
GNUNET_hash_to_enc (&h2->senderIdentity.hashPubKey, *host2entry);
-
+
GNUNET_free_non_null (h1);
GNUNET_free_non_null (h2);
- fprintf (stderr, "%s\n", ret == GNUNET_OK ? "Connected nodes." : "?");
GNUNET_client_connection_destroy (sock1);
GNUNET_client_connection_destroy (sock2);
}
Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2008-03-27 00:20:32 UTC
(rev 6629)
+++ GNUnet/src/applications/topology_default/topology.c 2008-03-27 00:49:25 UTC
(rev 6630)
@@ -523,11 +523,11 @@
"FRIENDS",
GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
"/friends", &fn);
- /**Nate change, don't beat me up if it's not pretty!*/
- if(GNUNET_OK != GNUNET_disk_file_test (ectx, fn))
- {
- GNUNET_disk_file_write (ectx,fn,NULL, 0,"600");
- }
+ /**Nate change, don't beat me up if it's not pretty!*/
+ if (GNUNET_OK != GNUNET_disk_file_test (ectx, fn))
+ {
+ GNUNET_disk_file_write (ectx, fn, NULL, 0, "600");
+ }
if ((0 == GNUNET_disk_file_test (ectx, fn))
|| (GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &size, GNUNET_YES)))
{
Modified: GNUnet/src/include/gnunet_remote_lib.h
===================================================================
--- GNUnet/src/include/gnunet_remote_lib.h 2008-03-27 00:20:32 UTC (rev
6629)
+++ GNUnet/src/include/gnunet_remote_lib.h 2008-03-27 00:49:25 UTC (rev
6630)
@@ -64,8 +64,8 @@
*/
struct GNUNET_REMOTE_friends_list
{
- struct GNUNET_REMOTE_friends_list *next;
- GNUNET_EncName *nodeid;
+ struct GNUNET_REMOTE_friends_list *next;
+ GNUNET_EncName *nodeid;
};
/**
@@ -81,7 +81,8 @@
int GNUNET_REMOTE_start_daemon (char *gnunetd_home,
char *localConfigPath, char *configFileName,
char *remote_config_path, char *ip_address,
- char *username,char *remote_friend_file_path);
+ char *username,
+ char *remote_friend_file_path);
/**
* Main start function to be called. Needs a remote config specified, as well
@@ -89,7 +90,8 @@
* types are defined in gnunet_remote_lib.h
*/
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,
+ GNUNET_REMOTE_TOPOLOGIES type_of_topology);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c 2008-03-27 00:20:32 UTC (rev
6629)
+++ GNUnet/src/util/network_client/tcpio.c 2008-03-27 00:49:25 UTC (rev
6630)
@@ -55,7 +55,7 @@
{
/**
- * the socket handle, NULL if not life
+ * the socket handle, NULL if not live
*/
struct GNUNET_SocketHandle *sock;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6630 - in GNUnet/src: applications/testing applications/topology_default include util/network_client,
gnunet <=