aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_manipulation_send_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_transport_api_manipulation_send_tcp.c')
-rw-r--r--src/transport/test_transport_api_manipulation_send_tcp.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c b/src/transport/test_transport_api_manipulation_send_tcp.c
index 90d0ef994..3043dc037 100644
--- a/src/transport/test_transport_api_manipulation_send_tcp.c
+++ b/src/transport/test_transport_api_manipulation_send_tcp.c
@@ -272,35 +272,46 @@ notify_ready (void *cls, size_t size, void *buf)
272 272
273 273
274static void 274static void
275sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 275sendtask (void *cls,
276 const struct GNUNET_SCHEDULER_TaskContext *tc)
276{ 277{
277 struct GNUNET_ATS_Information ats[1]; 278 struct GNUNET_TIME_Relative delay;
278 send_task = NULL; 279 struct GNUNET_ATS_Properties prop;
279 280
281 send_task = NULL;
280 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) 282 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
281 return; 283 return;
282 char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id)); 284 char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
283 285
284 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 286 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
285 "Sending message from peer %u (`%4s') -> peer %u (`%s') !\n", 287 "Sending message from peer %u (`%4s') -> peer %u (`%s') !\n",
286 p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); 288 p2->no,
289 GNUNET_i2s (&p2->id),
290 p1->no,
291 receiver_s);
287 GNUNET_free (receiver_s); 292 GNUNET_free (receiver_s);
288 293
289 294
290 if (0 == messages_recv) 295 if (0 == messages_recv)
291 { 296 {
292 start_normal = GNUNET_TIME_absolute_get(); 297 start_normal = GNUNET_TIME_absolute_get ();
293 } 298 }
294 if (1 == messages_recv) 299 if (1 == messages_recv)
295 { 300 {
296 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 301 memset (&prop, 0, sizeof (prop));
297 ats[0].value = htonl (1000LL * 1000LL); 302 delay.rel_value_us = 1000LL * 1000LL;
298 GNUNET_TRANSPORT_set_traffic_metric (p2->th, &p1->id, GNUNET_NO, GNUNET_YES, ats, 1); 303 GNUNET_TRANSPORT_set_traffic_metric (p2->th,
299 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); 304 &p1->id,
300 ats[0].value = htonl (10); 305 &prop,
301 GNUNET_TRANSPORT_set_traffic_metric (p1->th, &p2->id, GNUNET_YES, GNUNET_YES, ats, 1); 306 GNUNET_TIME_UNIT_ZERO,
302 307 delay);
303 start_delayed = GNUNET_TIME_absolute_get(); 308 prop.distance = 10;
309 GNUNET_TRANSPORT_set_traffic_metric (p1->th,
310 &p2->id,
311 &prop,
312 delay,
313 delay);
314 start_delayed = GNUNET_TIME_absolute_get();
304 } 315 }
305 316
306 s_sending = GNUNET_YES; 317 s_sending = GNUNET_YES;
@@ -358,7 +369,8 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
358 cc = NULL; 369 cc = NULL;
359 char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id)); 370 char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
360 371
361 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %u (%s) <-> %u (%s)\n", 372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
373 "Peers connected: %u (%s) <-> %u (%s)\n",
362 p1->no, p1_c, p2->no, GNUNET_i2s (&p2->id)); 374 p1->no, p1_c, p2->no, GNUNET_i2s (&p2->id));
363 GNUNET_free (p1_c); 375 GNUNET_free (p1_c);
364 376
@@ -386,16 +398,8 @@ start_cb (struct PeerContext *p, void *cls)
386 "Test tries to connect peer %u (`%s') -> peer %u (`%s')\n", 398 "Test tries to connect peer %u (`%s') -> peer %u (`%s')\n",
387 p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id)); 399 p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id));
388 GNUNET_free (sender_c); 400 GNUNET_free (sender_c);
389 /* 401 cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2,
390 struct GNUNET_ATS_Information ats[2]; 402 &testing_connect_cb,
391 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
392 ats[0].value = htonl (1000);
393 ats[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
394 ats[1].value = htonl (10);
395
396 GNUNET_TRANSPORT_set_traffic_metric (p1->th, &p2->id, TM_RECEIVE, ats, 2);
397*/
398 cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb,
399 NULL); 403 NULL);
400 404
401} 405}
@@ -485,4 +489,4 @@ main (int argc, char *argv[])
485 return ret; 489 return ret;
486} 490}
487 491
488/* end of test_transport_api.c */ 492/* end of test_transport_api_manipulation_send_tcp.c */