diff options
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index a2aaa19ec..76f8a9984 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -2500,14 +2500,20 @@ try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address, | |||
2500 | GST_ats_is_known (n->primary_address.address, | 2500 | GST_ats_is_known (n->primary_address.address, |
2501 | n->primary_address.session)); | 2501 | n->primary_address.session)); |
2502 | } | 2502 | } |
2503 | n->primary_address.bandwidth_in = bandwidth_in; | 2503 | if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__) |
2504 | n->primary_address.bandwidth_out = bandwidth_out; | 2504 | { |
2505 | GST_neighbours_set_incoming_quota (&address->peer, | 2505 | n->primary_address.bandwidth_in = bandwidth_in; |
2506 | bandwidth_in); | 2506 | GST_neighbours_set_incoming_quota (&address->peer, |
2507 | bandwidth_min = GNUNET_BANDWIDTH_value_min (bandwidth_out, | 2507 | bandwidth_in); |
2508 | n->neighbour_receive_quota); | 2508 | } |
2509 | send_outbound_quota_to_clients (&address->peer, | 2509 | if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) |
2510 | bandwidth_min); | 2510 | { |
2511 | n->primary_address.bandwidth_out = bandwidth_out; | ||
2512 | bandwidth_min = GNUNET_BANDWIDTH_value_min (bandwidth_out, | ||
2513 | n->neighbour_receive_quota); | ||
2514 | send_outbound_quota_to_clients (&address->peer, | ||
2515 | bandwidth_min); | ||
2516 | } | ||
2511 | return GNUNET_OK; | 2517 | return GNUNET_OK; |
2512 | } | 2518 | } |
2513 | 2519 | ||
@@ -3569,7 +3575,9 @@ GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target) | |||
3569 | 3575 | ||
3570 | 3576 | ||
3571 | /** | 3577 | /** |
3572 | * Change the incoming quota for the given peer. | 3578 | * Change the incoming quota for the given peer. Updates |
3579 | * our own receive rate and informs the neighbour about | ||
3580 | * the new quota. | ||
3573 | * | 3581 | * |
3574 | * @param neighbour identity of peer to change qutoa for | 3582 | * @param neighbour identity of peer to change qutoa for |
3575 | * @param quota new quota | 3583 | * @param quota new quota |
@@ -3593,7 +3601,21 @@ GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour, | |||
3593 | ntohl (quota.value__), GNUNET_i2s (&n->id)); | 3601 | ntohl (quota.value__), GNUNET_i2s (&n->id)); |
3594 | GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota); | 3602 | GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota); |
3595 | if (0 != ntohl (quota.value__)) | 3603 | if (0 != ntohl (quota.value__)) |
3604 | { | ||
3605 | struct SessionQuotaMessage sqm; | ||
3606 | |||
3607 | sqm.header.size = htons (sizeof (struct SessionQuotaMessage)); | ||
3608 | sqm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA); | ||
3609 | sqm.quota = quota.value__; | ||
3610 | (void) send_with_session (n, | ||
3611 | &sqm, | ||
3612 | sizeof (sqm), | ||
3613 | UINT32_MAX - 1, | ||
3614 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
3615 | GNUNET_NO, | ||
3616 | NULL, NULL); | ||
3596 | return; | 3617 | return; |
3618 | } | ||
3597 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 3619 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
3598 | "Disconnecting peer `%4s' due to SET_QUOTA\n", | 3620 | "Disconnecting peer `%4s' due to SET_QUOTA\n", |
3599 | GNUNET_i2s (&n->id)); | 3621 | GNUNET_i2s (&n->id)); |