diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-07-26 18:22:54 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-07-26 18:22:54 +0000 |
commit | 81eae49a1b5dfeadb9aac5974ec87cd01aed9ffd (patch) | |
tree | 35b65462b9209af4bd610552bb485ad22487400e /src/peerinfo/test_peerinfo_api.c | |
parent | bf4a9d8364675b34ac18d505e508006e2b773670 (diff) | |
download | gnunet-81eae49a1b5dfeadb9aac5974ec87cd01aed9ffd.tar.gz gnunet-81eae49a1b5dfeadb9aac5974ec87cd01aed9ffd.zip |
start service
Diffstat (limited to 'src/peerinfo/test_peerinfo_api.c')
-rw-r--r-- | src/peerinfo/test_peerinfo_api.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/peerinfo/test_peerinfo_api.c b/src/peerinfo/test_peerinfo_api.c index 460a3764d..15efeccad 100644 --- a/src/peerinfo/test_peerinfo_api.c +++ b/src/peerinfo/test_peerinfo_api.c | |||
@@ -44,6 +44,8 @@ static struct GNUNET_PEERINFO_Handle *h; | |||
44 | 44 | ||
45 | static unsigned int retries; | 45 | static unsigned int retries; |
46 | 46 | ||
47 | struct GNUNET_PeerIdentity pid; | ||
48 | |||
47 | static int | 49 | static int |
48 | check_it (void *cls, | 50 | check_it (void *cls, |
49 | const char *tname, | 51 | const char *tname, |
@@ -83,7 +85,6 @@ static void | |||
83 | add_peer () | 85 | add_peer () |
84 | { | 86 | { |
85 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; | 87 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; |
86 | struct GNUNET_PeerIdentity pid; | ||
87 | struct GNUNET_HELLO_Message *h2; | 88 | struct GNUNET_HELLO_Message *h2; |
88 | size_t agc; | 89 | size_t agc; |
89 | 90 | ||
@@ -91,7 +92,7 @@ add_peer () | |||
91 | memset (&pkey, 32, sizeof (pkey)); | 92 | memset (&pkey, 32, sizeof (pkey)); |
92 | GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey); | 93 | GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey); |
93 | h2 = GNUNET_HELLO_create (&pkey, &address_generator, &agc); | 94 | h2 = GNUNET_HELLO_create (&pkey, &address_generator, &agc); |
94 | GNUNET_PEERINFO_add_peer (h, h2); | 95 | GNUNET_PEERINFO_standalone_add_peer (h, h2); |
95 | GNUNET_free (h2); | 96 | GNUNET_free (h2); |
96 | 97 | ||
97 | } | 98 | } |
@@ -108,7 +109,7 @@ process (void *cls, | |||
108 | 109 | ||
109 | if (err_msg != NULL) | 110 | if (err_msg != NULL) |
110 | { | 111 | { |
111 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 112 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
112 | _("Error in communication with PEERINFO service\n")); | 113 | _("Error in communication with PEERINFO service\n")); |
113 | } | 114 | } |
114 | 115 | ||
@@ -121,8 +122,8 @@ process (void *cls, | |||
121 | /* try again */ | 122 | /* try again */ |
122 | retries++; | 123 | retries++; |
123 | add_peer (); | 124 | add_peer (); |
124 | ic = GNUNET_PEERINFO_iterate (h, | 125 | ic = GNUNET_PEERINFO_standalone_iterate (h, |
125 | NULL, | 126 | &pid, |
126 | GNUNET_TIME_relative_multiply | 127 | GNUNET_TIME_relative_multiply |
127 | (GNUNET_TIME_UNIT_SECONDS, 15), | 128 | (GNUNET_TIME_UNIT_SECONDS, 15), |
128 | &process, cls); | 129 | &process, cls); |
@@ -130,7 +131,7 @@ process (void *cls, | |||
130 | } | 131 | } |
131 | GNUNET_assert (peer == NULL); | 132 | GNUNET_assert (peer == NULL); |
132 | GNUNET_assert (2 == *ok); | 133 | GNUNET_assert (2 == *ok); |
133 | GNUNET_PEERINFO_disconnect (h); | 134 | GNUNET_PEERINFO_standalone_disconnect (h); |
134 | h = NULL; | 135 | h = NULL; |
135 | *ok = 0; | 136 | *ok = 0; |
136 | return; | 137 | return; |
@@ -153,11 +154,11 @@ run (void *cls, | |||
153 | const struct GNUNET_CONFIGURATION_Handle *c) | 154 | const struct GNUNET_CONFIGURATION_Handle *c) |
154 | { | 155 | { |
155 | cfg = c; | 156 | cfg = c; |
156 | h = GNUNET_PEERINFO_connect (cfg); | 157 | h = GNUNET_PEERINFO_standalone_connect (cfg); |
157 | GNUNET_assert (h != NULL); | 158 | GNUNET_assert (h != NULL); |
158 | add_peer (); | 159 | add_peer (); |
159 | ic = GNUNET_PEERINFO_iterate (h, | 160 | ic = GNUNET_PEERINFO_standalone_iterate (h, |
160 | NULL, | 161 | &pid, |
161 | GNUNET_TIME_relative_multiply | 162 | GNUNET_TIME_relative_multiply |
162 | (GNUNET_TIME_UNIT_SECONDS, 15), | 163 | (GNUNET_TIME_UNIT_SECONDS, 15), |
163 | &process, cls); | 164 | &process, cls); |