diff options
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 7697abdd3..75b8c6e56 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "plugin_transport.h" | 40 | #include "plugin_transport.h" |
41 | #include "transport.h" | 41 | #include "transport.h" |
42 | 42 | ||
43 | #define DEBUG_UDP GNUNET_NO | 43 | #define DEBUG_UDP GNUNET_YES |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * Transport cost to peer, always 1 for UDP (direct connection) | 46 | * Transport cost to peer, always 1 for UDP (direct connection) |
@@ -216,7 +216,16 @@ udp_plugin_send (void *cls, | |||
216 | ssize_t sent; | 216 | ssize_t sent; |
217 | 217 | ||
218 | GNUNET_assert(udp_sock != NULL); | 218 | GNUNET_assert(udp_sock != NULL); |
219 | GNUNET_assert(addr != NULL); | 219 | |
220 | if ((addr == NULL) || (addrlen == 0)) | ||
221 | { | ||
222 | #if DEBUG_UDP | ||
223 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "udp", _ | ||
224 | ("udp_plugin_send called without address, returning!\n")); | ||
225 | #endif | ||
226 | cont (cont_cls, target, GNUNET_OK); | ||
227 | return 0; /* Can never send if we don't have an address!! */ | ||
228 | } | ||
220 | 229 | ||
221 | /* Build the message to be sent */ | 230 | /* Build the message to be sent */ |
222 | message = GNUNET_malloc (sizeof (struct UDPMessage) + ntohs (msg->size)); | 231 | message = GNUNET_malloc (sizeof (struct UDPMessage) + ntohs (msg->size)); |
@@ -243,7 +252,13 @@ udp_plugin_send (void *cls, | |||
243 | if (sent == GNUNET_SYSERR) | 252 | if (sent == GNUNET_SYSERR) |
244 | cont (cont_cls, target, GNUNET_SYSERR); | 253 | cont (cont_cls, target, GNUNET_SYSERR); |
245 | else | 254 | else |
246 | cont (cont_cls, target, GNUNET_OK); | 255 | { |
256 | #if DEBUG_UDP | ||
257 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "udp", _ | ||
258 | ("Sucessfully sent message, calling transmit continuation!\n")); | ||
259 | #endif | ||
260 | cont (cont_cls, target, GNUNET_OK); | ||
261 | } | ||
247 | } | 262 | } |
248 | GNUNET_free (message); | 263 | GNUNET_free (message); |
249 | return sent; | 264 | return sent; |
@@ -405,7 +420,7 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
405 | ntohs (hdr->type)); | 420 | ntohs (hdr->type)); |
406 | #endif | 421 | #endif |
407 | plugin->env->receive (plugin->env->cls, | 422 | plugin->env->receive (plugin->env->cls, |
408 | sender, &msg->header, UDP_DIRECT_DISTANCE, (char *)&addr, fromlen); | 423 | sender, hdr, UDP_DIRECT_DISTANCE, (char *)&addr, fromlen); |
409 | 424 | ||
410 | GNUNET_free (sender); | 425 | GNUNET_free (sender); |
411 | GNUNET_free (buf); | 426 | GNUNET_free (buf); |
@@ -562,7 +577,7 @@ udp_check_address (void *cls, void *addr, size_t addrlen) | |||
562 | v6 = (struct sockaddr_in6 *) buf; | 577 | v6 = (struct sockaddr_in6 *) buf; |
563 | v6->sin6_port = htons (check_port (plugin, ntohs (v6->sin6_port))); | 578 | v6->sin6_port = htons (check_port (plugin, ntohs (v6->sin6_port))); |
564 | } | 579 | } |
565 | #if DEBUG_TCP | 580 | #if DEBUG_UDP |
566 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 581 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
567 | "tcp", | 582 | "tcp", |
568 | "Informing transport service about my address `%s'.\n", | 583 | "Informing transport service about my address `%s'.\n", |