+ /* update flags in connecting contexts */
+ found = GNUNET_NO;
+ GNUNET_TRANSPORT_TESTING_find_connecting_context (p,
+ p2,
+ &set_p1c,
+ &found);
+ if (GNUNET_NO == found)
+ {
+ cc = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_ConnectRequest);
+ cc->p1 = p;
+ cc->p2 = p2;
+ cc->p1_c = GNUNET_YES;
+ GNUNET_CONTAINER_DLL_insert (tth->cc_head,
+ tth->cc_tail,
+ cc);
+ }
+ found = GNUNET_NO;
+ GNUNET_TRANSPORT_TESTING_find_connecting_context (p2,
+ p,
+ &set_p2c,
+ &found);
+ if (GNUNET_NO == found)
+ {
+ cc = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_ConnectRequest);
+ cc->p1 = p2;
+ cc->p2 = p;
+ cc->p1_c = GNUNET_YES;
+ GNUNET_CONTAINER_DLL_insert (tth->cc_head,
+ tth->cc_tail,
+ cc);
+ }
+ GNUNET_TRANSPORT_TESTING_find_connecting_context (p,
+ p2,
+ &set_mq,
+ mq);
+ /* update set connected flag for all requests */
+ for (cc = tth->cc_head; NULL != cc; cc = cc->next)
+ {
+ if (GNUNET_YES == cc->connected)
+ continue;
+ if ( (GNUNET_YES == cc->p1_c) &&
+ (GNUNET_YES == cc->p2_c) )
+ {
+ cc->connected = GNUNET_YES;
+ /* stop trying to connect */
+ if (NULL != cc->tct)
+ {
+ GNUNET_SCHEDULER_cancel (cc->tct);
+ cc->tct = NULL;
+ }
+ if (NULL != cc->oh)
+ {
+ GNUNET_TRANSPORT_offer_hello_cancel (cc->oh);
+ cc->oh = NULL;
+ }
+ if (NULL != cc->ats_sh)
+ {
+ GNUNET_ATS_connectivity_suggest_cancel (cc->ats_sh);
+ cc->ats_sh = NULL;
+ }
+ }
+ }
+ /* then notify application */
+ for (cc = tth->cc_head; NULL != cc; cc = ccn)
+ {
+ ccn = cc->next;
+ if ( (GNUNET_YES == cc->connected) &&
+ (NULL != cc->cb) )
+ {
+ cc->cb (cc->cb_cls);
+ cc->cb = NULL; /* only notify once! */
+ }
+ }
+ return ret;