[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8641 - GNUnet/src/applications/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8641 - GNUnet/src/applications/testing |
Date: |
Tue, 7 Jul 2009 17:21:40 -0600 |
Author: nevans
Date: 2009-07-07 17:21:40 -0600 (Tue, 07 Jul 2009)
New Revision: 8641
Modified:
GNUnet/src/applications/testing/remote.c
GNUnet/src/applications/testing/remotetopologies.c
Log:
reduced redundant connecting
Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c 2009-07-07 22:43:05 UTC (rev
8640)
+++ GNUnet/src/applications/testing/remote.c 2009-07-07 23:21:40 UTC (rev
8641)
@@ -405,18 +405,18 @@
"MULTIPLE_SERVER_TESTING",
"MYSQL_SERVER", mysql_server);
GNUNET_GC_set_configuration_value_string (basecfg, NULL,
- "MULTIPLE_SERVER_TESTING",
"MYSQL_DB",
- mysql_db);
+ "MULTIPLE_SERVER_TESTING",
+ "MYSQL_DB", mysql_db);
GNUNET_GC_set_configuration_value_string (basecfg, NULL,
- "MULTIPLE_SERVER_TESTING",
"MYSQL_USER",
- mysql_user);
+ "MULTIPLE_SERVER_TESTING",
+ "MYSQL_USER", mysql_user);
GNUNET_GC_set_configuration_value_string (basecfg, NULL,
"MULTIPLE_SERVER_TESTING",
"MYSQL_PASSWORD",
mysql_password);
GNUNET_GC_set_configuration_value_number (basecfg, NULL,
- "MULTIPLE_SERVER_TESTING",
"MYSQL_PORT",
- mysql_port);
+ "MULTIPLE_SERVER_TESTING",
+ "MYSQL_PORT", mysql_port);
while (hostnames[pos] != ' ' && pos > 0)
pos--;
Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c 2009-07-07 22:43:05 UTC
(rev 8640)
+++ GNUnet/src/applications/testing/remotetopologies.c 2009-07-07 23:21:40 UTC
(rev 8641)
@@ -51,24 +51,49 @@
struct GNUNET_REMOTE_friends_list *node1temp;
struct GNUNET_REMOTE_friends_list *node2temp;
- node1temp = GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
- node2temp = GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
+ struct GNUNET_REMOTE_friends_list *node1iter;
+ struct GNUNET_REMOTE_friends_list *node2iter;
- node2temp->hostentry = node1pos;
- node1temp->hostentry = node2pos;
+ int addNode1 = 1;
+ int addNode2 = 1;
- node1temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
- node2temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
+ node1iter = node1pos->friend_entries;
+ node2iter = node2pos->friend_entries;
- memcpy (node1temp->nodeid, node2enc, sizeof (GNUNET_EncName));
- memcpy (node2temp->nodeid, node1enc, sizeof (GNUNET_EncName));
+ while (node2iter != NULL)
+ {
+ if (memcmp (node2iter->nodeid, node1enc, sizeof (GNUNET_EncName)) == 0)
+ addNode2 = 0;
+ node2iter = node2iter->next;
+ }
- node1temp->next = node1pos->friend_entries;
- node2temp->next = node2pos->friend_entries;
+ while (node1iter != NULL)
+ {
+ if (memcmp (node1iter->nodeid, node2enc, sizeof (GNUNET_EncName)) == 0)
+ addNode1 = 0;
+ node1iter = node1iter->next;
+ }
- node1pos->friend_entries = node1temp;
- node2pos->friend_entries = node2temp;
+ if (addNode1)
+ {
+ node1temp = GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
+ node1temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
+ memcpy (node1temp->nodeid, node2enc, sizeof (GNUNET_EncName));
+ node1temp->next = node1pos->friend_entries;
+ node1temp->hostentry = node2pos;
+ node1pos->friend_entries = node1temp;
+ }
+ if (addNode2)
+ {
+ node2temp = GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
+ node2temp->hostentry = node1pos;
+ node2temp->nodeid = GNUNET_malloc (sizeof (GNUNET_EncName));
+ memcpy (node2temp->nodeid, node1enc, sizeof (GNUNET_EncName));
+ node2temp->next = node2pos->friend_entries;
+ node2pos->friend_entries = node2temp;
+ }
+
return GNUNET_OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8641 - GNUnet/src/applications/testing,
gnunet <=