- if (p->hello != NULL)
- GNUNET_free (p->hello);
-
- if (p->cfg != NULL)
- GNUNET_CONFIGURATION_destroy (p->cfg);
-
- GNUNET_CONTAINER_DLL_remove (tth->p_head, tth->p_tail, p);
-
- GNUNET_free (p);
- p = NULL;
-}
-
-/**
- * Initiate peer p1 to connect to peer p2
- * Get peer p2's HELLO and offer it to p1
- * p1 then tries to connect to p2
- * @param p1 peer 1
- * @param p2 peer 2
- * @param cb the callback to call when both peers notified that they are connected
- * @param cb_cls callback cls
- * @return connect context
- */
-GNUNET_TRANSPORT_TESTING_ConnectRequest
-GNUNET_TRANSPORT_TESTING_connect_peers (struct GNUNET_TRANSPORT_TESTING_handle * tth,
- struct PeerContext *p1,
- struct PeerContext *p2,
- GNUNET_TRANSPORT_TESTING_connect_cb cb,
- void *cb_cls)
-
-{
- GNUNET_assert (tth != NULL);
-
- struct ConnectingContext *cc =
- GNUNET_malloc (sizeof (struct ConnectingContext));
-
- GNUNET_assert (p1 != NULL);
- GNUNET_assert (p2 != NULL);
-
- cc->p1 = p1;
- cc->p2 = p2;
-
- cc->cb = cb;
- cc->cb_cls = cb_cls;
-
- cc->th_p1 = p1->th;
- cc->th_p2 = p2->th;
-
- GNUNET_assert (cc->th_p1 != NULL);
- GNUNET_assert (cc->th_p2 != NULL);
-
- GNUNET_CONTAINER_DLL_insert (tth->cc_head, tth->cc_tail, cc);
-
- cc->tct = GNUNET_SCHEDULER_add_now (&try_connect, cc);
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
- "New connect request %X\n", cc);
-
- return cc;
-}
-
-/**
- * Cancel the request to connect two peers
- * Tou MUST cancel the request if you stop the peers before the peers connected succesfully
- * @param cc a connect request handle
- */
-void GNUNET_TRANSPORT_TESTING_connect_peers_cancel
- (struct GNUNET_TRANSPORT_TESTING_handle * tth,
- GNUNET_TRANSPORT_TESTING_ConnectRequest ccr)
-{
- struct ConnectingContext *cc = ccr;
-
- GNUNET_assert (tth != NULL);