diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-05-10 22:09:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-05-10 22:09:36 +0000 |
commit | 3bb766383b1fe0ec6e68e823601b797198f1c059 (patch) | |
tree | 86119cba7499a73d5f29e503b2a21fc6c7452abe /src | |
parent | 7f96c0370dfa90c1c6c64ae63e69c8ec3ae8b47f (diff) | |
download | gnunet-3bb766383b1fe0ec6e68e823601b797198f1c059.tar.gz gnunet-3bb766383b1fe0ec6e68e823601b797198f1c059.zip |
-trying to fix #2342
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 073773288..7bde633f2 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -963,6 +963,26 @@ enqueue (struct Plugin *plugin, struct UDPMessageWrapper * udpw) | |||
963 | GNUNET_CONTAINER_DLL_insert(plugin->ipv6_queue_head, plugin->ipv6_queue_tail, udpw); | 963 | GNUNET_CONTAINER_DLL_insert(plugin->ipv6_queue_head, plugin->ipv6_queue_tail, udpw); |
964 | } | 964 | } |
965 | 965 | ||
966 | |||
967 | /** | ||
968 | * Fragment message was transmitted via UDP, let fragmentation know | ||
969 | * to send the next fragment now. | ||
970 | * | ||
971 | * @param cls the 'struct UDPMessageWrapper' of the fragment | ||
972 | * @param target destination peer (ignored) | ||
973 | * @param result GNUNET_OK on success (ignored) | ||
974 | */ | ||
975 | static void | ||
976 | send_next_fragment (void *cls, | ||
977 | const struct GNUNET_PeerIdentity *target, | ||
978 | int result) | ||
979 | { | ||
980 | struct UDPMessageWrapper *udpw = cls; | ||
981 | |||
982 | GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag); | ||
983 | } | ||
984 | |||
985 | |||
966 | /** | 986 | /** |
967 | * Function that is called with messages created by the fragmentation | 987 | * Function that is called with messages created by the fragmentation |
968 | * module. In the case of the 'proc' callback of the | 988 | * module. In the case of the 'proc' callback of the |
@@ -992,8 +1012,8 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg) | |||
992 | udpw->udp = (char *) &udpw[1]; | 1012 | udpw->udp = (char *) &udpw[1]; |
993 | 1013 | ||
994 | udpw->msg_size = msg_len; | 1014 | udpw->msg_size = msg_len; |
995 | udpw->cont = frag_ctx->cont; | 1015 | udpw->cont = &send_next_fragment; |
996 | udpw->cont_cls = frag_ctx->cont_cls; | 1016 | udpw->cont_cls = udpw; |
997 | udpw->timeout = frag_ctx->timeout; | 1017 | udpw->timeout = frag_ctx->timeout; |
998 | udpw->frag_ctx = frag_ctx; | 1018 | udpw->frag_ctx = frag_ctx; |
999 | memcpy (udpw->udp, msg, msg_len); | 1019 | memcpy (udpw->udp, msg, msg_len); |
@@ -1850,15 +1870,8 @@ udp_select_send (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock) | |||
1850 | "UDP transmitted %u-byte message to `%s' (%d: %s)\n", | 1870 | "UDP transmitted %u-byte message to `%s' (%d: %s)\n", |
1851 | (unsigned int) (udpw->msg_size), GNUNET_a2s (sa, slen), (int) sent, | 1871 | (unsigned int) (udpw->msg_size), GNUNET_a2s (sa, slen), (int) sent, |
1852 | (sent < 0) ? STRERROR (errno) : "ok"); | 1872 | (sent < 0) ? STRERROR (errno) : "ok"); |
1853 | } | ||
1854 | /* This was just a message fragment */ | ||
1855 | if (udpw->frag_ctx != NULL) | ||
1856 | { | ||
1857 | GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag); | ||
1858 | } | ||
1859 | /* This was a complete message*/ | ||
1860 | else | ||
1861 | call_continuation(udpw, GNUNET_OK); | 1873 | call_continuation(udpw, GNUNET_OK); |
1874 | } | ||
1862 | 1875 | ||
1863 | if (sock == plugin->sockv4) | 1876 | if (sock == plugin->sockv4) |
1864 | GNUNET_CONTAINER_DLL_remove(plugin->ipv4_queue_head, plugin->ipv4_queue_tail, udpw); | 1877 | GNUNET_CONTAINER_DLL_remove(plugin->ipv4_queue_head, plugin->ipv4_queue_tail, udpw); |