aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-25 20:34:27 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-25 20:34:27 +0000
commit4960b423d6ac5e3e075a8c224cd71cc0a129a516 (patch)
treef1c799f7c5fc585d96d3f824aefa81488b4df18e /src/transport/transport-testing.c
parentd77b355a1365f2487964614e45ee1384ee7859d4 (diff)
downloadgnunet-4960b423d6ac5e3e075a8c224cd71cc0a129a516.tar.gz
gnunet-4960b423d6ac5e3e075a8c224cd71cc0a129a516.zip
simplify
Diffstat (limited to 'src/transport/transport-testing.c')
-rw-r--r--src/transport/transport-testing.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c
index 5d0e990f7..0b1c71d9b 100644
--- a/src/transport/transport-testing.c
+++ b/src/transport/transport-testing.c
@@ -187,20 +187,15 @@ get_hello (void *cb_cls, const struct GNUNET_MessageHeader *message)
187 GNUNET_assert (GNUNET_OK == 187 GNUNET_assert (GNUNET_OK ==
188 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) 188 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *)
189 message, &p->id)); 189 message, &p->id));
190
191 if (p->hello != NULL)
192 GNUNET_free (p->hello);
193
194 size_t size = GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *) message); 190 size_t size = GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *) message);
195 p->hello = GNUNET_malloc (size); 191 GNUNET_free_non_null (p->hello);
196 memcpy (p->hello, 192 p->hello = (struct GNUNET_HELLO_Message*) GNUNET_copy_message (message);
197 (const struct GNUNET_HELLO_Message *) message,
198 size);
199 193
200#if VERBOSE 194#if VERBOSE
201 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", 195 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
202 "New HELLO for peer %u (`%s') with size %u\n", 196 "transport-testing",
203 p->no, GNUNET_i2s (&p->id), size); 197 "New HELLO for peer %u (`%s') with size %u\n",
198 p->no, GNUNET_i2s (&p->id), size);
204#endif 199#endif
205 200
206 if (p->start_cb != NULL) 201 if (p->start_cb != NULL)
@@ -229,8 +224,9 @@ try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
229 224
230 char * p2_s = GNUNET_strdup(GNUNET_i2s (&p2->id)); 225 char * p2_s = GNUNET_strdup(GNUNET_i2s (&p2->id));
231 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", 226 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
232 "Asking peers %u (`%s') to connect peer %u (`%s')\n", 227 "Asking peer %u (`%s') to connect peer %u (`%s'), providing HELLO with %u bytes\n",
233 p1->no, GNUNET_i2s (&p1->id), p2->no, p2_s); 228 p1->no, GNUNET_i2s (&p1->id), p2->no, p2_s,
229 GNUNET_HELLO_size (cc->p2->hello));
234 GNUNET_free (p2_s); 230 GNUNET_free (p2_s);
235 231
236 GNUNET_TRANSPORT_offer_hello (cc->th_p1, 232 GNUNET_TRANSPORT_offer_hello (cc->th_p1,