[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26300 - in gnunet/src: include testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26300 - in gnunet/src: include testing |
Date: |
Mon, 4 Mar 2013 15:24:02 +0100 |
Author: harsha
Date: 2013-03-04 15:24:02 +0100 (Mon, 04 Mar 2013)
New Revision: 26300
Modified:
gnunet/src/include/gnunet_testing_lib.h
gnunet/src/testing/testing.c
Log:
cache peer identities
Modified: gnunet/src/include/gnunet_testing_lib.h
===================================================================
--- gnunet/src/include/gnunet_testing_lib.h 2013-03-04 14:09:27 UTC (rev
26299)
+++ gnunet/src/include/gnunet_testing_lib.h 2013-03-04 14:24:02 UTC (rev
26300)
@@ -226,7 +226,7 @@
* @param id identifier for the daemon, will be set
*/
void
-GNUNET_TESTING_peer_get_identity (const struct GNUNET_TESTING_Peer *peer,
+GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
struct GNUNET_PeerIdentity *id);
Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c 2013-03-04 14:09:27 UTC (rev 26299)
+++ gnunet/src/testing/testing.c 2013-03-04 14:24:02 UTC (rev 26300)
@@ -180,6 +180,12 @@
struct GNUNET_OS_Process *main_process;
/**
+ * The cached identity of this peer. Will be populated on call to
+ * GNUNET_TESTING_peer_get_identity()
+ */
+ struct GNUNET_PeerIdentity *id;
+
+ /**
* The keynumber of this peer's hostkey
*/
uint32_t key_number;
@@ -977,12 +983,19 @@
* @param id identifier for the daemon, will be set
*/
void
-GNUNET_TESTING_peer_get_identity (const struct GNUNET_TESTING_Peer *peer,
+GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
struct GNUNET_PeerIdentity *id)
{
+ if (NULL != peer->id)
+ {
+ memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
+ return;
+ }
+ peer->id = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
GNUNET_CRYPTO_ecc_key_free (GNUNET_TESTING_hostkey_get (peer->system,
peer->key_number,
- id));
+ peer->id));
+ memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
}
@@ -1101,6 +1114,7 @@
GNUNET_free (peer->cfgfile);
GNUNET_free (peer->main_binary);
GNUNET_free (peer->args);
+ GNUNET_free_non_null (peer->id);
GNUNET_free (peer);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26300 - in gnunet/src: include testing,
gnunet <=