aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-06-17 15:29:40 +0000
committerNathan S. Evans <evans@in.tum.de>2010-06-17 15:29:40 +0000
commit7f06c82295b46f1c8f1f3b16d5e979abea3e5660 (patch)
tree2f30ab82eb3d4bdde81ca75b5fb5fccf4abe79da /src/testing/testing.c
parent344da83a5a06b4b4db4eb68972ee49333369f2db (diff)
downloadgnunet-7f06c82295b46f1c8f1f3b16d5e979abea3e5660.tar.gz
gnunet-7f06c82295b46f1c8f1f3b16d5e979abea3e5660.zip
some testing changes, including an api change that likely breaks things for others
Diffstat (limited to 'src/testing/testing.c')
-rw-r--r--src/testing/testing.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 0c650d313..5b36fc380 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -1158,11 +1158,15 @@ struct ConnectContext
1158 */ 1158 */
1159 struct GNUNET_TIME_Relative timeout_hello; 1159 struct GNUNET_TIME_Relative timeout_hello;
1160 1160
1161
1162 /** 1161 /**
1163 * Was the connection attempt successful? 1162 * Was the connection attempt successful?
1164 */ 1163 */
1165 int connected; 1164 int connected;
1165
1166 /**
1167 * The distance between the two connected peers
1168 */
1169 uint32_t distance;
1166}; 1170};
1167 1171
1168 1172
@@ -1210,7 +1214,7 @@ notify_connect_result (void *cls,
1210 { 1214 {
1211 if (ctx->cb != NULL) 1215 if (ctx->cb != NULL)
1212 { 1216 {
1213 ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->d1->cfg, 1217 ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->distance, ctx->d1->cfg,
1214 ctx->d2->cfg, ctx->d1, ctx->d2, NULL); 1218 ctx->d2->cfg, ctx->d1, ctx->d2, NULL);
1215 } 1219 }
1216 } 1220 }
@@ -1234,7 +1238,7 @@ notify_connect_result (void *cls,
1234 { 1238 {
1235 if (ctx->cb != NULL) 1239 if (ctx->cb != NULL)
1236 { 1240 {
1237 ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->d1->cfg, 1241 ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, 0, ctx->d1->cfg,
1238 ctx->d2->cfg, ctx->d1, ctx->d2, 1242 ctx->d2->cfg, ctx->d1, ctx->d2,
1239 _("Peers failed to connect")); 1243 _("Peers failed to connect"));
1240 } 1244 }
@@ -1266,6 +1270,7 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity * peer, struct GNUNE
1266 if (memcmp(&ctx->d2->id, peer, sizeof(struct GNUNET_PeerIdentity)) == 0) 1270 if (memcmp(&ctx->d2->id, peer, sizeof(struct GNUNET_PeerIdentity)) == 0)
1267 { 1271 {
1268 ctx->connected = GNUNET_YES; 1272 ctx->connected = GNUNET_YES;
1273 ctx->distance = distance;
1269 GNUNET_SCHEDULER_cancel(ctx->d1->sched, ctx->timeout_task); 1274 GNUNET_SCHEDULER_cancel(ctx->d1->sched, ctx->timeout_task);
1270 ctx->timeout_task = GNUNET_SCHEDULER_add_now (ctx->d1->sched, 1275 ctx->timeout_task = GNUNET_SCHEDULER_add_now (ctx->d1->sched,
1271 &notify_connect_result, 1276 &notify_connect_result,
@@ -1319,7 +1324,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
1319 if ((d1->running == GNUNET_NO) || (d2->running == GNUNET_NO)) 1324 if ((d1->running == GNUNET_NO) || (d2->running == GNUNET_NO))
1320 { 1325 {
1321 if (NULL != cb) 1326 if (NULL != cb)
1322 cb (cb_cls, &d1->id, &d2->id, d1->cfg, d2->cfg, d1, d2, 1327 cb (cb_cls, &d1->id, &d2->id, 0, d1->cfg, d2->cfg, d1, d2,
1323 _("Peers are not fully running yet, can not connect!\n")); 1328 _("Peers are not fully running yet, can not connect!\n"));
1324 return; 1329 return;
1325 } 1330 }
@@ -1351,7 +1356,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
1351 { 1356 {
1352 GNUNET_free (ctx); 1357 GNUNET_free (ctx);
1353 if (NULL != cb) 1358 if (NULL != cb)
1354 cb (cb_cls, &d1->id, &d2->id, d1->cfg, d2->cfg, d1, d2, 1359 cb (cb_cls, &d1->id, &d2->id, 0, d1->cfg, d2->cfg, d1, d2,
1355 _("Failed to connect to core service of first peer!\n")); 1360 _("Failed to connect to core service of first peer!\n"));
1356 return; 1361 return;
1357 } 1362 }
@@ -1372,7 +1377,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
1372 GNUNET_CORE_disconnect(ctx->d1core); 1377 GNUNET_CORE_disconnect(ctx->d1core);
1373 GNUNET_free (ctx); 1378 GNUNET_free (ctx);
1374 if (NULL != cb) 1379 if (NULL != cb)
1375 cb (cb_cls, &d1->id, &d2->id, d1->cfg, d2->cfg, d1, d2, 1380 cb (cb_cls, &d1->id, &d2->id, 0, d1->cfg, d2->cfg, d1, d2,
1376 _("Failed to connect to transport service!\n")); 1381 _("Failed to connect to transport service!\n"));
1377 return; 1382 return;
1378 } 1383 }
@@ -1412,7 +1417,7 @@ reattempt_daemons_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext
1412 if (ctx->d1core == NULL) 1417 if (ctx->d1core == NULL)
1413 { 1418 {
1414 if (NULL != ctx->cb) 1419 if (NULL != ctx->cb)
1415 ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->d1->cfg, ctx->d2->cfg, ctx->d1, ctx->d2, 1420 ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, 0, ctx->d1->cfg, ctx->d2->cfg, ctx->d1, ctx->d2,
1416 _("Failed to connect to core service of first peer!\n")); 1421 _("Failed to connect to core service of first peer!\n"));
1417 GNUNET_free (ctx); 1422 GNUNET_free (ctx);
1418 return; 1423 return;
@@ -1425,7 +1430,7 @@ reattempt_daemons_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext
1425 GNUNET_CORE_disconnect(ctx->d1core); 1430 GNUNET_CORE_disconnect(ctx->d1core);
1426 GNUNET_free (ctx); 1431 GNUNET_free (ctx);
1427 if (NULL != ctx->cb) 1432 if (NULL != ctx->cb)
1428 ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->d1->cfg, ctx->d2->cfg, ctx->d1, ctx->d2, 1433 ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, 0, ctx->d1->cfg, ctx->d2->cfg, ctx->d1, ctx->d2,
1429 _("Failed to connect to transport service!\n")); 1434 _("Failed to connect to transport service!\n"));
1430 return; 1435 return;
1431 } 1436 }