diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-18 18:44:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-18 18:44:05 +0000 |
commit | 8144f329c27d9627a83003fc598410126f301cfe (patch) | |
tree | 7c98ba0d4dd62444e6fa2f32f3a9b38d70ab5c1a | |
parent | 70d9f0a4f731f35032cc84a85436dbd17c498260 (diff) | |
download | gnunet-8144f329c27d9627a83003fc598410126f301cfe.tar.gz gnunet-8144f329c27d9627a83003fc598410126f301cfe.zip |
-more logging, avoid duplicate re-scheduling
-rw-r--r-- | src/transport/plugin_transport_udp.c | 71 |
1 files changed, 48 insertions, 23 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index e9c25de59..2c95918f1 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -748,7 +748,9 @@ static void | |||
748 | schedule_select_v4 (struct Plugin *plugin) | 748 | schedule_select_v4 (struct Plugin *plugin) |
749 | { | 749 | { |
750 | struct GNUNET_TIME_Relative min_delay; | 750 | struct GNUNET_TIME_Relative min_delay; |
751 | struct GNUNET_TIME_Relative delay; | ||
751 | struct UDP_MessageWrapper *udpw; | 752 | struct UDP_MessageWrapper *udpw; |
753 | struct UDP_MessageWrapper *min_udpw; | ||
752 | 754 | ||
753 | if ( (GNUNET_YES == plugin->enable_ipv4) && | 755 | if ( (GNUNET_YES == plugin->enable_ipv4) && |
754 | (NULL != plugin->sockv4) ) | 756 | (NULL != plugin->sockv4) ) |
@@ -756,26 +758,35 @@ schedule_select_v4 (struct Plugin *plugin) | |||
756 | /* Find a message ready to send: | 758 | /* Find a message ready to send: |
757 | * Flow delay from other peer is expired or not set (0) */ | 759 | * Flow delay from other peer is expired or not set (0) */ |
758 | min_delay = GNUNET_TIME_UNIT_FOREVER_REL; | 760 | min_delay = GNUNET_TIME_UNIT_FOREVER_REL; |
761 | min_udpw = NULL; | ||
759 | for (udpw = plugin->ipv4_queue_head; NULL != udpw; udpw = udpw->next) | 762 | for (udpw = plugin->ipv4_queue_head; NULL != udpw; udpw = udpw->next) |
760 | min_delay = GNUNET_TIME_relative_min (min_delay, | 763 | { |
761 | GNUNET_TIME_absolute_get_remaining (udpw->transmission_time)); | 764 | delay = GNUNET_TIME_absolute_get_remaining (udpw->transmission_time); |
765 | if (delay.rel_value_us < min_delay.rel_value_us) | ||
766 | { | ||
767 | min_delay = delay; | ||
768 | min_udpw = udpw; | ||
769 | } | ||
770 | } | ||
762 | if (NULL != plugin->select_task_v4) | 771 | if (NULL != plugin->select_task_v4) |
763 | GNUNET_SCHEDULER_cancel (plugin->select_task_v4); | 772 | GNUNET_SCHEDULER_cancel (plugin->select_task_v4); |
764 | if (NULL != plugin->ipv4_queue_head) | 773 | if (NULL != min_udpw) |
765 | { | 774 | { |
766 | if (min_delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) | 775 | if (min_delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) |
767 | { | 776 | { |
768 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 777 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
769 | "Calculated flow delay for UDPv4 at %s\n", | 778 | "Calculated flow delay for UDPv4 at %s for %s\n", |
770 | GNUNET_STRINGS_relative_time_to_string (min_delay, | 779 | GNUNET_STRINGS_relative_time_to_string (min_delay, |
771 | GNUNET_YES)); | 780 | GNUNET_YES), |
781 | GNUNET_i2s (&udpw->session->target)); | ||
772 | } | 782 | } |
773 | else | 783 | else |
774 | { | 784 | { |
775 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 785 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
776 | "Calculated flow delay for UDPv4 at %s\n", | 786 | "Calculated flow delay for UDPv4 at %s for %s\n", |
777 | GNUNET_STRINGS_relative_time_to_string (min_delay, | 787 | GNUNET_STRINGS_relative_time_to_string (min_delay, |
778 | GNUNET_YES)); | 788 | GNUNET_YES), |
789 | GNUNET_i2s (&udpw->session->target)); | ||
779 | } | 790 | } |
780 | } | 791 | } |
781 | plugin->select_task_v4 | 792 | plugin->select_task_v4 |
@@ -796,32 +807,43 @@ static void | |||
796 | schedule_select_v6 (struct Plugin *plugin) | 807 | schedule_select_v6 (struct Plugin *plugin) |
797 | { | 808 | { |
798 | struct GNUNET_TIME_Relative min_delay; | 809 | struct GNUNET_TIME_Relative min_delay; |
810 | struct GNUNET_TIME_Relative delay; | ||
799 | struct UDP_MessageWrapper *udpw; | 811 | struct UDP_MessageWrapper *udpw; |
812 | struct UDP_MessageWrapper *min_udpw; | ||
800 | 813 | ||
801 | if ( (GNUNET_YES == plugin->enable_ipv6) && | 814 | if ( (GNUNET_YES == plugin->enable_ipv6) && |
802 | (NULL != plugin->sockv6) ) | 815 | (NULL != plugin->sockv6) ) |
803 | { | 816 | { |
804 | min_delay = GNUNET_TIME_UNIT_FOREVER_REL; | 817 | min_delay = GNUNET_TIME_UNIT_FOREVER_REL; |
818 | min_udpw = NULL; | ||
805 | for (udpw = plugin->ipv6_queue_head; NULL != udpw; udpw = udpw->next) | 819 | for (udpw = plugin->ipv6_queue_head; NULL != udpw; udpw = udpw->next) |
806 | min_delay = GNUNET_TIME_relative_min (min_delay, | 820 | { |
807 | GNUNET_TIME_absolute_get_remaining (udpw->transmission_time)); | 821 | delay = GNUNET_TIME_absolute_get_remaining (udpw->transmission_time); |
822 | if (delay.rel_value_us < min_delay.rel_value_us) | ||
823 | { | ||
824 | min_delay = delay; | ||
825 | min_udpw = udpw; | ||
826 | } | ||
827 | } | ||
808 | if (NULL != plugin->select_task_v6) | 828 | if (NULL != plugin->select_task_v6) |
809 | GNUNET_SCHEDULER_cancel (plugin->select_task_v6); | 829 | GNUNET_SCHEDULER_cancel (plugin->select_task_v6); |
810 | if (NULL != plugin->ipv6_queue_head) | 830 | if (NULL != min_udpw) |
811 | { | 831 | { |
812 | if (min_delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) | 832 | if (min_delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) |
813 | { | 833 | { |
814 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 834 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
815 | "Calculated flow delay for UDPv6 at %s\n", | 835 | "Calculated flow delay for UDPv6 at %s for %s\n", |
816 | GNUNET_STRINGS_relative_time_to_string (min_delay, | 836 | GNUNET_STRINGS_relative_time_to_string (min_delay, |
817 | GNUNET_YES)); | 837 | GNUNET_YES), |
838 | GNUNET_i2s (&udpw->session->target)); | ||
818 | } | 839 | } |
819 | else | 840 | else |
820 | { | 841 | { |
821 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 842 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
822 | "Calculated flow delay for UDPv6 at %s\n", | 843 | "Calculated flow delay for UDPv6 at %s for %s\n", |
823 | GNUNET_STRINGS_relative_time_to_string (min_delay, | 844 | GNUNET_STRINGS_relative_time_to_string (min_delay, |
824 | GNUNET_YES)); | 845 | GNUNET_YES), |
846 | GNUNET_i2s (&udpw->session->target)); | ||
825 | } | 847 | } |
826 | } | 848 | } |
827 | plugin->select_task_v6 | 849 | plugin->select_task_v6 |
@@ -2097,10 +2119,6 @@ udp_plugin_send (void *cls, | |||
2097 | frag_ctx); | 2119 | frag_ctx); |
2098 | s->frag_ctx = frag_ctx; | 2120 | s->frag_ctx = frag_ctx; |
2099 | s->last_transmit_time = frag_ctx->next_frag_time; | 2121 | s->last_transmit_time = frag_ctx->next_frag_time; |
2100 | if (sizeof (struct IPv4UdpAddress) == s->address->address_length) | ||
2101 | schedule_select_v4 (plugin); | ||
2102 | else | ||
2103 | schedule_select_v6 (plugin); | ||
2104 | GNUNET_STATISTICS_update (plugin->env->stats, | 2122 | GNUNET_STATISTICS_update (plugin->env->stats, |
2105 | "# UDP, fragmented messages active", | 2123 | "# UDP, fragmented messages active", |
2106 | 1, | 2124 | 1, |
@@ -2189,11 +2207,18 @@ read_process_ack (struct Plugin *plugin, | |||
2189 | GNUNET_HELLO_address_free (address); | 2207 | GNUNET_HELLO_address_free (address); |
2190 | 2208 | ||
2191 | flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay); | 2209 | flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay); |
2192 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2210 | if (flow_delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) |
2193 | "We received a sending delay of %s for %s\n", | 2211 | LOG (GNUNET_ERROR_TYPE_WARNING, |
2194 | GNUNET_STRINGS_relative_time_to_string (flow_delay, | 2212 | "We received a sending delay of %s for %s\n", |
2195 | GNUNET_YES), | 2213 | GNUNET_STRINGS_relative_time_to_string (flow_delay, |
2196 | GNUNET_i2s (&udp_ack->sender)); | 2214 | GNUNET_YES), |
2215 | GNUNET_i2s (&udp_ack->sender)); | ||
2216 | else | ||
2217 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2218 | "We received a sending delay of %s for %s\n", | ||
2219 | GNUNET_STRINGS_relative_time_to_string (flow_delay, | ||
2220 | GNUNET_YES), | ||
2221 | GNUNET_i2s (&udp_ack->sender)); | ||
2197 | /* Flow delay is for the reassembled packet, however, our delay | 2222 | /* Flow delay is for the reassembled packet, however, our delay |
2198 | is per packet, so we need to adjust: */ | 2223 | is per packet, so we need to adjust: */ |
2199 | flow_delay = GNUNET_TIME_relative_divide (flow_delay, | 2224 | flow_delay = GNUNET_TIME_relative_divide (flow_delay, |