From 72cb328c689aacf5a20a0107e5762c1749ea2886 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Fri, 28 Aug 2020 18:01:10 +0200 Subject: - fixed some bugs --- src/include/gnunet_transport_communication_service.h | 8 ++++++++ src/transport/gnunet-communicator-tcp.c | 12 +++++++++--- src/transport/transport_api2_communication.c | 15 ++++++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/include/gnunet_transport_communication_service.h b/src/include/gnunet_transport_communication_service.h index ea6b95e2d..431b9a671 100644 --- a/src/include/gnunet_transport_communication_service.h +++ b/src/include/gnunet_transport_communication_service.h @@ -336,6 +336,14 @@ void GNUNET_TRANSPORT_communicator_address_remove ( struct GNUNET_TRANSPORT_AddressIdentifier *ai); +/** + * Notify transport service that this communicator no longer provides all its addresses for this peer. + * + * @param ch The communicator handle. + */ +void +GNUNET_TRANSPORT_communicator_address_remove_all ( + struct GNUNET_TRANSPORT_CommunicatorHandle *ch); /** * The communicator asks the transport service to route a message via diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index 1783edb91..4caef909c 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c @@ -2944,6 +2944,10 @@ static void do_shutdown (void *cls) { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Shutdown %s!\n", + shutdown_running ? "running" : "not running"); + if (GNUNET_YES == shutdown_running) return; else @@ -2958,6 +2962,7 @@ do_shutdown (void *cls) } GNUNET_CONTAINER_multipeermap_iterate (queue_map, &get_queue_delete_it, NULL); GNUNET_CONTAINER_multipeermap_destroy (queue_map); + GNUNET_TRANSPORT_communicator_address_remove_all (ch); if (NULL != ch) { GNUNET_TRANSPORT_communicator_disconnect (ch); @@ -3038,8 +3043,9 @@ nat_address_cb (void *cls, char *my_addr; struct GNUNET_TRANSPORT_AddressIdentifier *ai; - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "nat address cb %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "nat address cb %s %s\n", + add_remove ? "add" : "remove", GNUNET_a2s (addr, addrlen)); if (GNUNET_YES == add_remove) @@ -3162,7 +3168,7 @@ init_socket (struct sockaddr *addr, sto_len = in_len; } - addr = (struct sockaddr *) &in_sto; + //addr = (struct sockaddr *) &in_sto; in_len = sto_len; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Bound to `%s'\n", diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index d1e28cc36..b048ad851 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c @@ -1081,7 +1081,6 @@ GNUNET_TRANSPORT_communicator_address_add ( return ai; } - /** * Notify transport service about an address that this communicator no * longer provides for this peer. @@ -1100,6 +1099,20 @@ GNUNET_TRANSPORT_communicator_address_remove ( GNUNET_free (ai); } +/** + * Notify transport service that this communicator no longer provides all its addresses for this peer. + * + * @param ch The communicator handle. + */ +void +GNUNET_TRANSPORT_communicator_address_remove_all ( + struct GNUNET_TRANSPORT_CommunicatorHandle *ch) +{ + for (struct GNUNET_TRANSPORT_AddressIdentifier *ai = ch->ai_head; NULL != ai; + ai = ai->next) + GNUNET_TRANSPORT_communicator_address_remove (ai); +} + /* ************************* Backchannel *************************** */ -- cgit v1.2.3