diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-04-21 11:37:56 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-04-21 11:37:56 +0200 |
commit | 300bb8d62d412eccb1537cbdaf27b8264fa6fc19 (patch) | |
tree | e5c097394c1ccfe605e945d263198100e367426c /src/transport | |
parent | 32485c3b58983ada1943b3fa27eac3b0cff2a9da (diff) | |
download | gnunet-300bb8d62d412eccb1537cbdaf27b8264fa6fc19.tar.gz gnunet-300bb8d62d412eccb1537cbdaf27b8264fa6fc19.zip |
fix quota out calculation, even if it may go away
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-tng.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index 3bef2b4e7..b2f0838bf 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -23,15 +23,6 @@ | |||
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | * | 24 | * |
25 | * TODO: | 25 | * TODO: |
26 | * - figure out how to transmit (selective) ACKs in case of uni-directional | ||
27 | * communicators (with/without core? DV-only?) When do we use ACKs? | ||
28 | * => communicators use selective ACKs for flow control | ||
29 | * => transport uses message-level ACKs for RTT, fragment confirmation | ||
30 | * => integrate DV into transport, use neither core nor communicators | ||
31 | * but rather give communicators transport-encapsulated messages | ||
32 | * (which could be core-data, background-channel traffic, or | ||
33 | * transport-to-transport traffic) | ||
34 | * | ||
35 | * Implement next: | 26 | * Implement next: |
36 | * - retransmission logic | 27 | * - retransmission logic |
37 | * - track RTT, distance, loss, etc. => requires extra data structures! | 28 | * - track RTT, distance, loss, etc. => requires extra data structures! |
@@ -1078,6 +1069,20 @@ struct DistanceVector | |||
1078 | struct GNUNET_SCHEDULER_Task *visibility_task; | 1069 | struct GNUNET_SCHEDULER_Task *visibility_task; |
1079 | 1070 | ||
1080 | /** | 1071 | /** |
1072 | * Quota at which CORE is allowed to transmit to this peer | ||
1073 | * (note that the value CORE should actually be told is this | ||
1074 | * value plus the respective value in `struct Neighbour`). | ||
1075 | * Should match the sum of the quotas of all of the paths. | ||
1076 | * | ||
1077 | * FIXME: not yet set, tricky to get right given multiple paths, | ||
1078 | * many of which may be inactive! (=> Idea: measure???) | ||
1079 | * FIXME: how do we set this value initially when we tell CORE? | ||
1080 | * Options: start at a minimum value or at literally zero? | ||
1081 | * (=> Current thought: clean would be zero!) | ||
1082 | */ | ||
1083 | struct GNUNET_BANDWIDTH_Value32NBO quota_out; | ||
1084 | |||
1085 | /** | ||
1081 | * Is one of the DV paths in this struct 'confirmed' and thus | 1086 | * Is one of the DV paths in this struct 'confirmed' and thus |
1082 | * the cause for CORE to see this peer as connected? (Note that | 1087 | * the cause for CORE to see this peer as connected? (Note that |
1083 | * the same may apply to a `struct Neighbour` at the same time.) | 1088 | * the same may apply to a `struct Neighbour` at the same time.) |
@@ -1421,9 +1426,12 @@ struct Neighbour | |||
1421 | struct GNUNET_SCHEDULER_Task *timeout_task; | 1426 | struct GNUNET_SCHEDULER_Task *timeout_task; |
1422 | 1427 | ||
1423 | /** | 1428 | /** |
1424 | * Quota at which CORE is allowed to transmit to this peer. | 1429 | * Quota at which CORE is allowed to transmit to this peer |
1430 | * (note that the value CORE should actually be told is this | ||
1431 | * value plus the respective value in `struct DistanceVector`). | ||
1432 | * Should match the sum of the quotas of all of the queues. | ||
1425 | * | 1433 | * |
1426 | * FIXME: not yet used, tricky to get right given multiple queues! | 1434 | * FIXME: not yet set, tricky to get right given multiple queues! |
1427 | * (=> Idea: measure???) | 1435 | * (=> Idea: measure???) |
1428 | * FIXME: how do we set this value initially when we tell CORE? | 1436 | * FIXME: how do we set this value initially when we tell CORE? |
1429 | * Options: start at a minimum value or at literally zero? | 1437 | * Options: start at a minimum value or at literally zero? |
@@ -4685,7 +4693,11 @@ activate_core_visible_dv_path (struct DistanceVectorHop *hop) | |||
4685 | n = GNUNET_CONTAINER_multipeermap_get (neighbours, &dv->target); | 4693 | n = GNUNET_CONTAINER_multipeermap_get (neighbours, &dv->target); |
4686 | if ((NULL != n) && (GNUNET_YES == n->core_visible)) | 4694 | if ((NULL != n) && (GNUNET_YES == n->core_visible)) |
4687 | return; /* no need to tell core, connection already up! */ | 4695 | return; /* no need to tell core, connection already up! */ |
4688 | cores_send_connect_info (&dv->target, GNUNET_BANDWIDTH_ZERO); | 4696 | cores_send_connect_info (&dv->target, |
4697 | (NULL != n) | ||
4698 | ? GNUNET_BANDWDITH_value_sum (n->quota_out, | ||
4699 | dv->quota_out) | ||
4700 | : dv->quota_out); | ||
4689 | } | 4701 | } |
4690 | 4702 | ||
4691 | 4703 | ||
@@ -5626,6 +5638,7 @@ handle_validation_response (void *cls, | |||
5626 | struct GNUNET_TIME_Absolute origin_time; | 5638 | struct GNUNET_TIME_Absolute origin_time; |
5627 | struct Queue *q; | 5639 | struct Queue *q; |
5628 | struct DistanceVector *dv; | 5640 | struct DistanceVector *dv; |
5641 | struct Neighbour *n; | ||
5629 | 5642 | ||
5630 | /* check this is one of our challenges */ | 5643 | /* check this is one of our challenges */ |
5631 | (void) GNUNET_CONTAINER_multipeermap_get_multiple (validation_map, | 5644 | (void) GNUNET_CONTAINER_multipeermap_get_multiple (validation_map, |
@@ -5722,20 +5735,25 @@ handle_validation_response (void *cls, | |||
5722 | } | 5735 | } |
5723 | q->validated_until = vs->validated_until; | 5736 | q->validated_until = vs->validated_until; |
5724 | q->rtt = vs->validation_rtt; | 5737 | q->rtt = vs->validation_rtt; |
5725 | if (GNUNET_NO != q->neighbour->core_visible) | 5738 | n = q->neighbour; |
5739 | if (GNUNET_NO != n->core_visible) | ||
5726 | return; /* nothing changed, we are done here */ | 5740 | return; /* nothing changed, we are done here */ |
5727 | q->neighbour->core_visible = GNUNET_YES; | 5741 | n->core_visible = GNUNET_YES; |
5728 | q->visibility_task = GNUNET_SCHEDULER_add_at (q->validated_until, | 5742 | q->visibility_task = GNUNET_SCHEDULER_add_at (q->validated_until, |
5729 | &core_queue_visibility_check, | 5743 | &core_queue_visibility_check, |
5730 | q); | 5744 | q); |
5731 | /* Check if _any_ DV route to this neighbour is | 5745 | /* Check if _any_ DV route to this neighbour is |
5732 | currently valid, if so, do NOT tell core anything! */ | 5746 | currently valid, if so, do NOT tell core anything! */ |
5733 | dv = GNUNET_CONTAINER_multipeermap_get (dv_routes, &q->neighbour->pid); | 5747 | dv = GNUNET_CONTAINER_multipeermap_get (dv_routes, &n->pid); |
5734 | if (GNUNET_YES == dv->core_visible) | 5748 | if ((NULL != dv) && (GNUNET_YES == dv->core_visible)) |
5735 | return; /* nothing changed, done */ | 5749 | return; /* nothing changed, done */ |
5736 | /* We lacked a confirmed connection to the neighbour | 5750 | /* We lacked a confirmed connection to the neighbour |
5737 | before, so tell CORE about it (finally!) */ | 5751 | before, so tell CORE about it (finally!) */ |
5738 | cores_send_connect_info (&q->neighbour->pid, GNUNET_BANDWIDTH_ZERO); | 5752 | cores_send_connect_info (&n->pid, |
5753 | (NULL != dv) | ||
5754 | ? GNUNET_BANDWIDTH_value_sum (dv->quota_out, | ||
5755 | n->quota_out) | ||
5756 | : n->quota_out); | ||
5739 | } | 5757 | } |
5740 | 5758 | ||
5741 | 5759 | ||