diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-10-21 16:04:46 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-10-21 16:04:46 +0000 |
commit | 30deabaf6460ef605637dfd1b4b1cf79839e5c9f (patch) | |
tree | 428da302abcdb9b573af489cc2188a07d8093ddd /src/transport | |
parent | eb49bd8bd671fa3c8997cbea5f139132c1db843c (diff) | |
download | gnunet-30deabaf6460ef605637dfd1b4b1cf79839e5c9f.tar.gz gnunet-30deabaf6460ef605637dfd1b4b1cf79839e5c9f.zip |
activating client_new implementation, seems to mostly work fine, or better than the old one
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/transport_api_core.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c index f6ea43db9..de18a140c 100644 --- a/src/transport/transport_api_core.c +++ b/src/transport/transport_api_core.c | |||
@@ -354,6 +354,25 @@ handle_hello (void *cls, | |||
354 | * @param cls the `struct Neighbour` where the message was sent | 354 | * @param cls the `struct Neighbour` where the message was sent |
355 | */ | 355 | */ |
356 | static void | 356 | static void |
357 | notify_send_done_fin (void *cls) | ||
358 | { | ||
359 | struct Neighbour *n = cls; | ||
360 | |||
361 | n->timeout_task = NULL; | ||
362 | n->is_ready = GNUNET_YES; | ||
363 | GNUNET_MQ_impl_send_continue (n->mq); | ||
364 | } | ||
365 | |||
366 | |||
367 | /** | ||
368 | * A message from the handler's message queue to a neighbour was | ||
369 | * transmitted. Now trigger (possibly delayed) notification of the | ||
370 | * neighbour's message queue that we are done and thus ready for | ||
371 | * the next message. | ||
372 | * | ||
373 | * @param cls the `struct Neighbour` where the message was sent | ||
374 | */ | ||
375 | static void | ||
357 | notify_send_done (void *cls) | 376 | notify_send_done (void *cls) |
358 | { | 377 | { |
359 | struct Neighbour *n = cls; | 378 | struct Neighbour *n = cls; |
@@ -364,8 +383,8 @@ notify_send_done (void *cls) | |||
364 | { | 383 | { |
365 | GNUNET_BANDWIDTH_tracker_consume (&n->out_tracker, | 384 | GNUNET_BANDWIDTH_tracker_consume (&n->out_tracker, |
366 | n->env_size + n->traffic_overhead); | 385 | n->env_size + n->traffic_overhead); |
367 | n->traffic_overhead = 0; | ||
368 | n->env = NULL; | 386 | n->env = NULL; |
387 | n->traffic_overhead = 0; | ||
369 | } | 388 | } |
370 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, | 389 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, |
371 | 128); | 390 | 128); |
@@ -375,10 +394,11 @@ notify_send_done (void *cls) | |||
375 | GNUNET_MQ_impl_send_continue (n->mq); | 394 | GNUNET_MQ_impl_send_continue (n->mq); |
376 | return; | 395 | return; |
377 | } | 396 | } |
397 | GNUNET_MQ_impl_send_in_flight (n->mq); | ||
378 | /* cannot send even a small message without violating | 398 | /* cannot send even a small message without violating |
379 | quota, wait a before notifying MQ */ | 399 | quota, wait a before allowing MQ to send next message */ |
380 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (delay, | 400 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (delay, |
381 | ¬ify_send_done, | 401 | ¬ify_send_done_fin, |
382 | n); | 402 | n); |
383 | } | 403 | } |
384 | 404 | ||
@@ -411,6 +431,7 @@ mq_send_impl (struct GNUNET_MQ_Handle *mq, | |||
411 | GNUNET_MQ_impl_send_continue (mq); | 431 | GNUNET_MQ_impl_send_continue (mq); |
412 | return; | 432 | return; |
413 | } | 433 | } |
434 | GNUNET_assert (NULL == n->env); | ||
414 | n->env = GNUNET_MQ_msg_nested_mh (obm, | 435 | n->env = GNUNET_MQ_msg_nested_mh (obm, |
415 | GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, | 436 | GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, |
416 | msg); | 437 | msg); |