aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing.c')
-rw-r--r--src/testing/testing.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c
index d178995e0..fed3d87df 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -545,7 +545,9 @@ start_fsm (void *cls,
545 d->phase = SP_START_CORE; 545 d->phase = SP_START_CORE;
546 d->server = GNUNET_CORE_connect (d->cfg, 546 d->server = GNUNET_CORE_connect (d->cfg,
547 1, 547 1,
548#if NO_MORE_TIMEOUT_FIXME
548 ARM_START_WAIT, 549 ARM_START_WAIT,
550#endif
549 d, 551 d,
550 &testing_init, 552 &testing_init,
551 NULL, NULL, NULL, 553 NULL, NULL, NULL,
@@ -1347,8 +1349,15 @@ notify_connect_result (void *cls,
1347 { 1349 {
1348 if (ctx->cb != NULL) 1350 if (ctx->cb != NULL)
1349 { 1351 {
1350 ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->distance, ctx->d1->cfg, 1352 ctx->cb (ctx->cb_cls,
1351 ctx->d2->cfg, ctx->d1, ctx->d2, NULL); 1353 &ctx->d1->id,
1354 &ctx->d2->id,
1355 ctx->distance,
1356 ctx->d1->cfg,
1357 ctx->d2->cfg,
1358 ctx->d1,
1359 ctx->d2,
1360 NULL);
1352 } 1361 }
1353 } 1362 }
1354 else if (remaining.rel_value > 0) 1363 else if (remaining.rel_value > 0)
@@ -1397,25 +1406,24 @@ notify_connect_result (void *cls,
1397 * 1406 *
1398 * @param cls our "struct ConnectContext" 1407 * @param cls our "struct ConnectContext"
1399 * @param peer identity of the peer that has connected 1408 * @param peer identity of the peer that has connected
1400 * @param latency the round trip latency of the connection to this peer 1409 * @param atsi performance information
1401 * @param distance distance the transport level distance to this peer
1402 * 1410 *
1403 */ 1411 */
1404static void 1412static void
1405connect_notify (void *cls, const struct GNUNET_PeerIdentity * peer, struct GNUNET_TIME_Relative latency, 1413connect_notify (void *cls,
1406 uint32_t distance) 1414 const struct GNUNET_PeerIdentity * peer,
1415 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
1407{ 1416{
1408 struct ConnectContext *ctx = cls; 1417 struct ConnectContext *ctx = cls;
1409 1418
1410 if (memcmp(&ctx->d2->id, peer, sizeof(struct GNUNET_PeerIdentity)) == 0) 1419 if (memcmp(&ctx->d2->id, peer, sizeof(struct GNUNET_PeerIdentity)) == 0)
1411 { 1420 {
1412 ctx->connected = GNUNET_YES; 1421 ctx->connected = GNUNET_YES;
1413 ctx->distance = distance; 1422 ctx->distance = 0; /* FIXME: distance */
1414 GNUNET_SCHEDULER_cancel(ctx->timeout_task); 1423 GNUNET_SCHEDULER_cancel(ctx->timeout_task);
1415 ctx->timeout_task = GNUNET_SCHEDULER_add_now (&notify_connect_result, 1424 ctx->timeout_task = GNUNET_SCHEDULER_add_now (&notify_connect_result,
1416 ctx); 1425 ctx);
1417 } 1426 }
1418
1419} 1427}
1420 1428
1421#if CONNECT_CORE2 1429#if CONNECT_CORE2
@@ -1424,20 +1432,20 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity * peer, struct GNUNE
1424 * 1432 *
1425 * @param cls our "struct ConnectContext" 1433 * @param cls our "struct ConnectContext"
1426 * @param peer identity of the peer that has connected 1434 * @param peer identity of the peer that has connected
1427 * @param latency the round trip latency of the connection to this peer 1435 * @param atsi performance information
1428 * @param distance distance the transport level distance to this peer
1429 * 1436 *
1430 */ 1437 */
1431static void 1438static void
1432connect_notify_core2 (void *cls, const struct GNUNET_PeerIdentity * peer, struct GNUNET_TIME_Relative latency, 1439connect_notify_core2 (void *cls,
1433 uint32_t distance) 1440 const struct GNUNET_PeerIdentity * peer,
1441 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
1434{ 1442{
1435 struct ConnectContext *ctx = cls; 1443 struct ConnectContext *ctx = cls;
1436 1444
1437 if (memcmp(&ctx->d2->id, peer, sizeof(struct GNUNET_PeerIdentity)) == 0) 1445 if (memcmp(&ctx->d2->id, peer, sizeof(struct GNUNET_PeerIdentity)) == 0)
1438 { 1446 {
1439 ctx->connected = GNUNET_YES; 1447 ctx->connected = GNUNET_YES;
1440 ctx->distance = distance; 1448 ctx->distance = 0; /* FIXME: distance */
1441 GNUNET_SCHEDULER_cancel(ctx->timeout_task); 1449 GNUNET_SCHEDULER_cancel(ctx->timeout_task);
1442 ctx->timeout_task = GNUNET_SCHEDULER_add_now (&notify_connect_result, 1450 ctx->timeout_task = GNUNET_SCHEDULER_add_now (&notify_connect_result,
1443 ctx); 1451 ctx);
@@ -1477,7 +1485,7 @@ send_hello(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1477 GNUNET_assert(hello != NULL); 1485 GNUNET_assert(hello != NULL);
1478 GNUNET_TRANSPORT_offer_hello (ctx->d2th, hello); 1486 GNUNET_TRANSPORT_offer_hello (ctx->d2th, hello);
1479 1487
1480 ctx->connect_request_handle = GNUNET_CORE_peer_request_connect (ctx->d2->cfg, 1488 ctx->connect_request_handle = GNUNET_CORE_peer_request_connect (ctx->d2->server,
1481 GNUNET_TIME_relative_divide(ctx->relative_timeout, 1489 GNUNET_TIME_relative_divide(ctx->relative_timeout,
1482 ctx->max_connect_attempts + 1), 1490 ctx->max_connect_attempts + 1),
1483 &ctx->d1->id, 1491 &ctx->d1->id,
@@ -1539,7 +1547,9 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
1539 1547
1540 ctx->d1core = GNUNET_CORE_connect (d1->cfg, 1548 ctx->d1core = GNUNET_CORE_connect (d1->cfg,
1541 1, 1549 1,
1550#if NO_MORE_TIMEOUT_FIXME
1542 timeout, 1551 timeout,
1552#endif
1543 ctx, 1553 ctx,
1544 NULL, 1554 NULL,
1545 &connect_notify, NULL, NULL, 1555 &connect_notify, NULL, NULL,
@@ -1557,7 +1567,9 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
1557#if CONNECT_CORE2 1567#if CONNECT_CORE2
1558 ctx->d2core = GNUNET_CORE_connect (d2->cfg, 1568 ctx->d2core = GNUNET_CORE_connect (d2->cfg,
1559 1, 1569 1,
1570#if NO_MORE_TIMEOUT_FIXME
1560 timeout, 1571 timeout,
1572#endif
1561 ctx, 1573 ctx,
1562 NULL, 1574 NULL,
1563 NULL, NULL, NULL, 1575 NULL, NULL, NULL,
@@ -1620,7 +1632,9 @@ reattempt_daemons_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext
1620 1632
1621 ctx->d1core = GNUNET_CORE_connect (ctx->d1->cfg, 1633 ctx->d1core = GNUNET_CORE_connect (ctx->d1->cfg,
1622 1, 1634 1,
1635#if NO_MORE_TIMEOUT_FIXME
1623 GNUNET_TIME_absolute_get_remaining(ctx->timeout), 1636 GNUNET_TIME_absolute_get_remaining(ctx->timeout),
1637#endif
1624 ctx, 1638 ctx,
1625 NULL, 1639 NULL,
1626 &connect_notify, NULL, NULL, 1640 &connect_notify, NULL, NULL,