diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-22 16:55:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-22 16:55:16 +0000 |
commit | 98ea57dd2236542414e52792672d8563c8ca4294 (patch) | |
tree | 2b8e660b1f1ff325e447cf84b8eaa363ab77123c /src | |
parent | 48436941449d867ef9a32ddf29439c5017d37775 (diff) | |
download | gnunet-98ea57dd2236542414e52792672d8563c8ca4294.tar.gz gnunet-98ea57dd2236542414e52792672d8563c8ca4294.zip |
fix
Diffstat (limited to 'src')
-rw-r--r-- | src/peerinfo/gnunet-service-peerinfo.c | 4 | ||||
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 2 | ||||
-rw-r--r-- | src/peerinfo/test_peerinfo_api.c | 32 |
3 files changed, 20 insertions, 18 deletions
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 9ac38ea9f..c67d35e38 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -486,8 +486,6 @@ send_to_each_host (const struct GNUNET_PeerIdentity *only, | |||
486 | change_host_trust (&pos->identity, trust_change); | 486 | change_host_trust (&pos->identity, trust_change); |
487 | hs = 0; | 487 | hs = 0; |
488 | im = (struct InfoMessage *) buf; | 488 | im = (struct InfoMessage *) buf; |
489 | im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO); | ||
490 | im->header.size = htons (sizeof (struct InfoMessage) + hs); | ||
491 | if (pos->hello != NULL) | 489 | if (pos->hello != NULL) |
492 | { | 490 | { |
493 | hs = GNUNET_HELLO_size (pos->hello); | 491 | hs = GNUNET_HELLO_size (pos->hello); |
@@ -496,6 +494,8 @@ send_to_each_host (const struct GNUNET_PeerIdentity *only, | |||
496 | sizeof (struct InfoMessage)); | 494 | sizeof (struct InfoMessage)); |
497 | memcpy (&im[1], pos->hello, hs); | 495 | memcpy (&im[1], pos->hello, hs); |
498 | } | 496 | } |
497 | im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO); | ||
498 | im->header.size = htons (sizeof (struct InfoMessage) + hs); | ||
499 | im->trust = htonl (pos->trust); | 499 | im->trust = htonl (pos->trust); |
500 | im->peer = pos->identity; | 500 | im->peer = pos->identity; |
501 | GNUNET_SERVER_transmit_context_append_message (tc, | 501 | GNUNET_SERVER_transmit_context_append_message (tc, |
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 0f95a421a..5531ede97 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -223,7 +223,7 @@ info_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
223 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 223 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
224 | "Size of `%s' is %u bytes\n", | 224 | "Size of `%s' is %u bytes\n", |
225 | "HELLO", | 225 | "HELLO", |
226 | (unsigned int) GNUNET_HELLO_size (hello)); | 226 | (hello == NULL) ? 0 : (unsigned int) GNUNET_HELLO_size (hello)); |
227 | #endif | 227 | #endif |
228 | ic->callback (ic->callback_cls, &im->peer, hello, ntohl (im->trust)); | 228 | ic->callback (ic->callback_cls, &im->peer, hello, ntohl (im->trust)); |
229 | GNUNET_CLIENT_receive (ic->client, | 229 | GNUNET_CLIENT_receive (ic->client, |
diff --git a/src/peerinfo/test_peerinfo_api.c b/src/peerinfo/test_peerinfo_api.c index 0b5230eb6..0bea99b01 100644 --- a/src/peerinfo/test_peerinfo_api.c +++ b/src/peerinfo/test_peerinfo_api.c | |||
@@ -40,6 +40,8 @@ static struct GNUNET_SCHEDULER_Handle *sched; | |||
40 | 40 | ||
41 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 41 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
42 | 42 | ||
43 | static struct GNUNET_PEERINFO_IteratorContext *ic; | ||
44 | |||
43 | static unsigned int retries; | 45 | static unsigned int retries; |
44 | 46 | ||
45 | static int | 47 | static int |
@@ -105,19 +107,20 @@ process (void *cls, | |||
105 | 107 | ||
106 | if (peer == NULL) | 108 | if (peer == NULL) |
107 | { | 109 | { |
110 | ic = NULL; | ||
108 | if ( (3 == *ok) && | 111 | if ( (3 == *ok) && |
109 | (retries < 5) ) | 112 | (retries < 50) ) |
110 | { | 113 | { |
111 | /* try again */ | 114 | /* try again */ |
112 | retries++; | 115 | retries++; |
113 | add_peer (); | 116 | add_peer (); |
114 | GNUNET_PEERINFO_iterate (cfg, | 117 | ic = GNUNET_PEERINFO_iterate (cfg, |
115 | sched, | 118 | sched, |
116 | NULL, | 119 | NULL, |
117 | 0, | 120 | 0, |
118 | GNUNET_TIME_relative_multiply | 121 | GNUNET_TIME_relative_multiply |
119 | (GNUNET_TIME_UNIT_SECONDS, 15), | 122 | (GNUNET_TIME_UNIT_SECONDS, 15), |
120 | &process, cls); | 123 | &process, cls); |
121 | return; | 124 | return; |
122 | } | 125 | } |
123 | GNUNET_assert (peer == NULL); | 126 | GNUNET_assert (peer == NULL); |
@@ -126,7 +129,6 @@ process (void *cls, | |||
126 | *ok = 0; | 129 | *ok = 0; |
127 | return; | 130 | return; |
128 | } | 131 | } |
129 | |||
130 | if (hello != NULL) | 132 | if (hello != NULL) |
131 | { | 133 | { |
132 | GNUNET_assert (3 == *ok); | 134 | GNUNET_assert (3 == *ok); |
@@ -148,12 +150,12 @@ run (void *cls, | |||
148 | sched = s; | 150 | sched = s; |
149 | cfg = c; | 151 | cfg = c; |
150 | add_peer (); | 152 | add_peer (); |
151 | GNUNET_PEERINFO_iterate (cfg, | 153 | ic = GNUNET_PEERINFO_iterate (cfg, |
152 | sched, | 154 | sched, |
153 | NULL, | 155 | NULL, |
154 | 0, | 156 | 0, |
155 | GNUNET_TIME_relative_multiply | 157 | GNUNET_TIME_relative_multiply |
156 | (GNUNET_TIME_UNIT_SECONDS, 15), &process, cls); | 158 | (GNUNET_TIME_UNIT_SECONDS, 15), &process, cls); |
157 | } | 159 | } |
158 | 160 | ||
159 | 161 | ||