aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-09-06 14:39:22 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-09-06 14:39:22 +0000
commit12b718136eeeb1fa919e8be60bcd497533a79963 (patch)
tree704a7fe998fa0a7c2f60e36d3a7d20b706e7a8e4 /src/transport/plugin_transport_udp.c
parent224092cedfcffab0ef12bb452261e69eecb09322 (diff)
downloadgnunet-12b718136eeeb1fa919e8be60bcd497533a79963.tar.gz
gnunet-12b718136eeeb1fa919e8be60bcd497533a79963.zip
udp now working with new transport service
udp plugin should not call transmit_continuation, if NULL
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 92fa8d2f5..cced16ffd 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -325,7 +325,8 @@ udp_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
325 &target->hashPubKey, 325 &target->hashPubKey,
326 session)); 326 session));
327 plugin->last_expected_delay = GNUNET_FRAGMENT_context_destroy (session->frag); 327 plugin->last_expected_delay = GNUNET_FRAGMENT_context_destroy (session->frag);
328 session->cont (session->cont_cls, target, GNUNET_SYSERR); 328 if (session->cont != NULL)
329 session->cont (session->cont_cls, target, GNUNET_SYSERR);
329 GNUNET_free (session); 330 GNUNET_free (session);
330} 331}
331 332
@@ -406,6 +407,8 @@ send_fragment (void *cls, const struct GNUNET_MessageHeader *msg)
406 GNUNET_FRAGMENT_context_transmission_done (session->frag); 407 GNUNET_FRAGMENT_context_transmission_done (session->frag);
407} 408}
408 409
410static const char *
411udp_address_to_string (void *cls, const void *addr, size_t addrlen);
409 412
410/** 413/**
411 * Function that can be used by the transport service to transmit 414 * Function that can be used by the transport service to transmit
@@ -461,7 +464,8 @@ udp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
461 case sizeof (struct IPv4UdpAddress): 464 case sizeof (struct IPv4UdpAddress):
462 if (NULL == plugin->sockv4) 465 if (NULL == plugin->sockv4)
463 { 466 {
464 cont (cont_cls, target, GNUNET_SYSERR); 467 if (cont != NULL)
468 cont (cont_cls, target, GNUNET_SYSERR);
465 return 0; 469 return 0;
466 } 470 }
467 t4 = addr; 471 t4 = addr;
@@ -479,7 +483,8 @@ udp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
479 case sizeof (struct IPv6UdpAddress): 483 case sizeof (struct IPv6UdpAddress):
480 if (NULL == plugin->sockv6) 484 if (NULL == plugin->sockv6)
481 { 485 {
482 cont (cont_cls, target, GNUNET_SYSERR); 486 if (cont != NULL)
487 cont (cont_cls, target, GNUNET_SYSERR);
483 return 0; 488 return 0;
484 } 489 }
485 t6 = addr; 490 t6 = addr;
@@ -513,8 +518,9 @@ udp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
513 if (mlen <= UDP_MTU) 518 if (mlen <= UDP_MTU)
514 { 519 {
515 mlen = udp_send (plugin, peer_session->sock_addr, &udp->header); 520 mlen = udp_send (plugin, peer_session->sock_addr, &udp->header);
516 cont (cont_cls, target, (mlen > 0) ? GNUNET_OK : GNUNET_SYSERR); 521 if (cont != NULL)
517 GNUNET_free (peer_session); 522 cont (cont_cls, target, (mlen > 0) ? GNUNET_OK : GNUNET_SYSERR);
523 GNUNET_free_non_null (peer_session);
518 } 524 }
519 else 525 else
520 { 526 {
@@ -857,7 +863,8 @@ udp_read (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *rsock)
857 peer_session)); 863 peer_session));
858 plugin->last_expected_delay = 864 plugin->last_expected_delay =
859 GNUNET_FRAGMENT_context_destroy (peer_session->frag); 865 GNUNET_FRAGMENT_context_destroy (peer_session->frag);
860 peer_session->cont (peer_session->cont_cls, &udp->sender, GNUNET_OK); 866 if (peer_session->cont != NULL)
867 peer_session->cont (peer_session->cont_cls, &udp->sender, GNUNET_OK);
861 GNUNET_free (peer_session); 868 GNUNET_free (peer_session);
862 return; 869 return;
863 case GNUNET_MESSAGE_TYPE_FRAGMENT: 870 case GNUNET_MESSAGE_TYPE_FRAGMENT: