gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8823 - GNUnet/src/applications/testing


From: gnunet
Subject: [GNUnet-SVN] r8823 - GNUnet/src/applications/testing
Date: Mon, 10 Aug 2009 14:56:41 -0600

Author: nevans
Date: 2009-08-10 14:56:41 -0600 (Mon, 10 Aug 2009)
New Revision: 8823

Modified:
   GNUnet/src/applications/testing/remote.c
   GNUnet/src/applications/testing/remote.h
   GNUnet/src/applications/testing/remotetopologies.c
Log:
less overhead for keeping pids around

Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c    2009-08-09 08:25:58 UTC (rev 
8822)
+++ GNUnet/src/applications/testing/remote.c    2009-08-10 20:56:41 UTC (rev 
8823)
@@ -250,18 +250,21 @@
   fprintf (stderr, _("exec command is : %s \n"), cmd);
 #endif
 
-  output = popen (cmd, "r");
-  GNUNET_free (cmd);
-  if (fscanf (output, "%d", &pid) == 1)
+  if ((cmd != NULL) && (strcmp(cmd, "") != 0))
+  {
+    output = popen (cmd, "r");
+    GNUNET_free (cmd);
+    if ((output != NULL) && (fscanf (output, "%d", &pid) == 1))
     {
 #if VERBOSE
       fprintf (stderr, _("Got pid %d\n"), pid);
 #endif
     }
-  else
+    else
     {
-      pid = -1;
+        pid = -1;
     }
+  }
 
   return pid;
 }
@@ -617,7 +620,7 @@
                                                         &temp_port);
               temp_pos->port = (unsigned short) temp_port;
               temp_pos->next = head;
-              temp_pos->context = new_ret_peers;
+              temp_pos->pid = get_pid(new_ret_peers);
               head = temp_pos;
               array_of_pointers[count_started] = temp_pos;
               count_started++;
@@ -811,7 +814,7 @@
 
                   temp_pos->port = (unsigned short) temp_port;
                   temp_pos->next = head;
-                  temp_pos->context = new_ret_peers;
+                  temp_pos->pid = get_pid(new_ret_peers);
                   head = temp_pos;
                   array_of_pointers[count_started] = temp_pos;
                   count_started++;
@@ -991,8 +994,8 @@
           friend_pos = pos->friend_entries;
           while (friend_pos != NULL)
             {
-              pid1 = get_pid(pos->context);
-              pid2 = get_pid(friend_pos->hostentry->context);
+              pid1 = pos->pid;
+              pid2 = friend_pos->hostentry->pid;
 #if VERBOSE
               fprintf (stderr, _("connecting peer %s:%d pid=%d to peer %s:%d 
pid=%d\n"),
                        pos->hostname, pos->port, pid1,

Modified: GNUnet/src/applications/testing/remote.h
===================================================================
--- GNUnet/src/applications/testing/remote.h    2009-08-09 08:25:58 UTC (rev 
8822)
+++ GNUnet/src/applications/testing/remote.h    2009-08-10 20:56:41 UTC (rev 
8823)
@@ -46,7 +46,7 @@
   char *remote_friend_file_path;
   char *username;
   unsigned short port;
-  struct GNUNET_REMOTE_TESTING_DaemonContext *context;
+  pid_t pid;
 };
 
 /* Simple linked list to store friends lists for each node,

Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c  2009-08-09 08:25:58 UTC 
(rev 8822)
+++ GNUnet/src/applications/testing/remotetopologies.c  2009-08-10 20:56:41 UTC 
(rev 8823)
@@ -632,8 +632,11 @@
 
         }
 
-      GNUNET_hash_to_enc (&h1->senderIdentity.hashPubKey, host1entry);
-      GNUNET_hash_to_enc (&h2->senderIdentity.hashPubKey, host2entry);
+      if (ret == GNUNET_OK)
+      {
+        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);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]