aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 9ae9712a9..c310afc22 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -756,18 +756,24 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target,
756 * 756 *
757 * @param sender sender of the message 757 * @param sender sender of the message
758 * @param size size of the message 758 * @param size size of the message
759 * @param do_forward set to GNUNET_YES if the message should be forwarded to clients
760 * GNUNET_NO if the neighbour is not connected or violates the quota
759 * @return how long to wait before reading more from this sender 761 * @return how long to wait before reading more from this sender
760 */ 762 */
761struct GNUNET_TIME_Relative 763struct GNUNET_TIME_Relative
762GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity *sender, 764GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity *sender,
763 ssize_t size) 765 ssize_t size,
766 int *do_forward)
764{ 767{
765 struct NeighbourMapEntry *n; 768 struct NeighbourMapEntry *n;
766 struct GNUNET_TIME_Relative ret; 769 struct GNUNET_TIME_Relative ret;
767 770
768 n = lookup_neighbour (sender); 771 n = lookup_neighbour (sender);
769 if (n == NULL) 772 if (n == NULL)
770 return GNUNET_TIME_UNIT_ZERO; 773 {
774 *do_forward = GNUNET_NO;
775 return GNUNET_TIME_UNIT_ZERO;
776 }
771 if (GNUNET_YES == GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, 777 if (GNUNET_YES == GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker,
772 size)) 778 size))
773 { 779 {
@@ -802,8 +808,10 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity *sender
802 gettext_noop ("# bandwidth quota violations by other peers"), 808 gettext_noop ("# bandwidth quota violations by other peers"),
803 1, 809 1,
804 GNUNET_NO); 810 GNUNET_NO);
811 *do_forward = GNUNET_NO;
805 return GNUNET_CONSTANTS_QUOTA_VIOLATION_TIMEOUT; 812 return GNUNET_CONSTANTS_QUOTA_VIOLATION_TIMEOUT;
806 } 813 }
814 *do_forward = GNUNET_YES;
807 ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0); 815 ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0);
808 if (ret.rel_value > 0) 816 if (ret.rel_value > 0)
809 { 817 {