diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-10-19 14:59:57 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-10-19 14:59:57 +0000 |
commit | 2196beb936a96e5341522655ad885a41a09c3558 (patch) | |
tree | 9b2266b495073ebb7d731de790560b87b8e4e1c3 /src | |
parent | 2d05195fcef5070a203bf2a8b55ef3e5f429d4c7 (diff) | |
download | gnunet-2196beb936a96e5341522655ad885a41a09c3558.tar.gz gnunet-2196beb936a96e5341522655ad885a41a09c3558.zip |
- dangerous things for a friday: fragmented message timeout
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 3f9738055..b6b13eab2 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -712,6 +712,7 @@ static void | |||
712 | call_continuation (struct UDP_MessageWrapper *udpw, int result) | 712 | call_continuation (struct UDP_MessageWrapper *udpw, int result) |
713 | { | 713 | { |
714 | size_t overhead; | 714 | size_t overhead; |
715 | struct UDP_MessageWrapper dummy; | ||
715 | 716 | ||
716 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 717 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
717 | "Calling continuation for %u byte message to `%s' with result %s\n", | 718 | "Calling continuation for %u byte message to `%s' with result %s\n", |
@@ -750,6 +751,7 @@ call_continuation (struct UDP_MessageWrapper *udpw, int result) | |||
750 | udpw->payload_size, GNUNET_NO); | 751 | udpw->payload_size, GNUNET_NO); |
751 | break; | 752 | break; |
752 | case MSG_FRAGMENTED_COMPLETE: | 753 | case MSG_FRAGMENTED_COMPLETE: |
754 | GNUNET_assert (NULL != udpw->frag_ctx); | ||
753 | if (udpw->frag_ctx->cont != NULL) | 755 | if (udpw->frag_ctx->cont != NULL) |
754 | udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, &udpw->session->target, GNUNET_OK, | 756 | udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, &udpw->session->target, GNUNET_OK, |
755 | udpw->frag_ctx->payload_size, udpw->frag_ctx->on_wire_size); | 757 | udpw->frag_ctx->payload_size, udpw->frag_ctx->on_wire_size); |
@@ -768,6 +770,9 @@ call_continuation (struct UDP_MessageWrapper *udpw, int result) | |||
768 | GNUNET_STATISTICS_update (plugin->env->stats, | 770 | GNUNET_STATISTICS_update (plugin->env->stats, |
769 | "# UDP, total, bytes payload, sent", | 771 | "# UDP, total, bytes payload, sent", |
770 | udpw->payload_size, GNUNET_NO); | 772 | udpw->payload_size, GNUNET_NO); |
773 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
774 | "# UDP, fragmented msgs, messages, pending", | ||
775 | -1, GNUNET_NO); | ||
771 | break; | 776 | break; |
772 | case MSG_FRAGMENTED: | 777 | case MSG_FRAGMENTED: |
773 | /* Fragmented message: enqueue next fragment */ | 778 | /* Fragmented message: enqueue next fragment */ |
@@ -780,9 +785,6 @@ call_continuation (struct UDP_MessageWrapper *udpw, int result) | |||
780 | GNUNET_STATISTICS_update (plugin->env->stats, | 785 | GNUNET_STATISTICS_update (plugin->env->stats, |
781 | "# UDP, fragmented msgs, fragments bytes, sent, success", | 786 | "# UDP, fragmented msgs, fragments bytes, sent, success", |
782 | udpw->msg_size, GNUNET_NO); | 787 | udpw->msg_size, GNUNET_NO); |
783 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
784 | "# UDP, fragmented msgs, messages, pending", | ||
785 | -1, GNUNET_NO); | ||
786 | break; | 788 | break; |
787 | case MSG_ACK: | 789 | case MSG_ACK: |
788 | /* No continuation */ | 790 | /* No continuation */ |
@@ -824,8 +826,9 @@ call_continuation (struct UDP_MessageWrapper *udpw, int result) | |||
824 | overhead, GNUNET_NO); | 826 | overhead, GNUNET_NO); |
825 | break; | 827 | break; |
826 | case MSG_FRAGMENTED_COMPLETE: | 828 | case MSG_FRAGMENTED_COMPLETE: |
829 | GNUNET_assert (NULL != udpw->frag_ctx); | ||
827 | if (udpw->frag_ctx->cont != NULL) | 830 | if (udpw->frag_ctx->cont != NULL) |
828 | udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, &udpw->session->target, GNUNET_OK, | 831 | udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, &udpw->session->target, GNUNET_SYSERR, |
829 | udpw->frag_ctx->payload_size, udpw->frag_ctx->on_wire_size); | 832 | udpw->frag_ctx->payload_size, udpw->frag_ctx->on_wire_size); |
830 | GNUNET_STATISTICS_update (plugin->env->stats, | 833 | GNUNET_STATISTICS_update (plugin->env->stats, |
831 | "# UDP, fragmented msgs, messages, sent, failure", | 834 | "# UDP, fragmented msgs, messages, sent, failure", |
@@ -836,8 +839,15 @@ call_continuation (struct UDP_MessageWrapper *udpw, int result) | |||
836 | GNUNET_STATISTICS_update (plugin->env->stats, | 839 | GNUNET_STATISTICS_update (plugin->env->stats, |
837 | "# UDP, fragmented msgs, bytes payload, sent, failure", | 840 | "# UDP, fragmented msgs, bytes payload, sent, failure", |
838 | overhead, GNUNET_NO); | 841 | overhead, GNUNET_NO); |
842 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
843 | "# UDP, fragmented msgs, bytes payload, sent, failure", | ||
844 | overhead, GNUNET_NO); | ||
845 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
846 | "# UDP, fragmented msgs, messages, pending", | ||
847 | -1, GNUNET_NO); | ||
839 | break; | 848 | break; |
840 | case MSG_FRAGMENTED: | 849 | case MSG_FRAGMENTED: |
850 | GNUNET_assert (NULL != udpw->frag_ctx); | ||
841 | /* Fragmented message: failed to send */ | 851 | /* Fragmented message: failed to send */ |
842 | GNUNET_STATISTICS_update (plugin->env->stats, | 852 | GNUNET_STATISTICS_update (plugin->env->stats, |
843 | "# UDP, fragmented msgs, fragments, sent, failure", | 853 | "# UDP, fragmented msgs, fragments, sent, failure", |
@@ -846,6 +856,14 @@ call_continuation (struct UDP_MessageWrapper *udpw, int result) | |||
846 | "# UDP, fragmented msgs, fragments bytes, sent, failure", | 856 | "# UDP, fragmented msgs, fragments bytes, sent, failure", |
847 | udpw->msg_size, GNUNET_NO); | 857 | udpw->msg_size, GNUNET_NO); |
848 | 858 | ||
859 | dummy.msg_type = MSG_FRAGMENTED_COMPLETE; | ||
860 | dummy.msg_buf = NULL; | ||
861 | dummy.msg_size = udpw->frag_ctx->on_wire_size; | ||
862 | dummy.payload_size = udpw->frag_ctx->payload_size; | ||
863 | dummy.frag_ctx = udpw->frag_ctx; | ||
864 | dummy.session = udpw->session; | ||
865 | call_continuation (&dummy, GNUNET_SYSERR); | ||
866 | |||
849 | break; | 867 | break; |
850 | case MSG_ACK: | 868 | case MSG_ACK: |
851 | /* ACK message: failed to send */ | 869 | /* ACK message: failed to send */ |
@@ -1992,10 +2010,6 @@ read_process_ack (struct Plugin *plugin, | |||
1992 | dummy.frag_ctx = s->frag_ctx; | 2010 | dummy.frag_ctx = s->frag_ctx; |
1993 | dummy.session = s; | 2011 | dummy.session = s; |
1994 | 2012 | ||
1995 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1996 | "# UDP, fragmented msgs, messages, pending", | ||
1997 | -1, GNUNET_NO); | ||
1998 | |||
1999 | call_continuation (&dummy, GNUNET_OK); | 2013 | call_continuation (&dummy, GNUNET_OK); |
2000 | 2014 | ||
2001 | GNUNET_free (s->frag_ctx); | 2015 | GNUNET_free (s->frag_ctx); |