From db5fce6cd527aa49fb5762d730564a918131a30f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 29 Aug 2009 19:37:54 +0000 Subject: [PATCH] renames --- src/util/Makefile.am | 50 +++++++++---------- src/util/{network.c => connection.c} | 46 +++++++++-------- .../{test_network.c => test_connection.c} | 8 +-- ...ressing.c => test_connection_addressing.c} | 8 +-- ...cel.c => test_connection_receive_cancel.c} | 8 +-- ...rk_timeout.c => test_connection_timeout.c} | 8 +-- ...c => test_connection_timeout_no_connect.c} | 8 +-- ...el.c => test_connection_transmit_cancel.c} | 8 +-- 8 files changed, 73 insertions(+), 71 deletions(-) rename src/util/{network.c => connection.c} (98%) rename src/util/{test_network.c => test_connection.c} (97%) rename src/util/{test_network_addressing.c => test_connection_addressing.c} (97%) rename src/util/{test_network_receive_cancel.c => test_connection_receive_cancel.c} (95%) rename src/util/{test_network_timeout.c => test_connection_timeout.c} (96%) rename src/util/{test_network_timeout_no_connect.c => test_connection_timeout_no_connect.c} (90%) rename src/util/{test_network_transmit_cancel.c => test_connection_transmit_cancel.c} (92%) diff --git a/src/util/Makefile.am b/src/util/Makefile.am index d58d80bac..37ff8250b 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -22,6 +22,7 @@ libgnunetutil_la_SOURCES = \ common_gettext.c \ common_logging.c \ configuration.c \ + connection.c \ container_bloomfilter.c \ container_meta_data.c \ container_multihashmap.c \ @@ -37,7 +38,6 @@ libgnunetutil_la_SOURCES = \ getopt.c \ getopt_helpers.c \ network.c \ - network_socket.c \ os_installation.c \ os_load.c \ os_network.c \ @@ -93,12 +93,12 @@ check_PROGRAMS = \ test_crypto_rsa \ test_disk \ test_getopt \ - test_network \ - test_network_addressing \ - test_network_receive_cancel \ - test_network_timeout \ - test_network_timeout_no_connect \ - test_network_transmit_cancel \ + test_connection \ + test_connection_addressing \ + test_connection_receive_cancel \ + test_connection_timeout \ + test_connection_timeout_no_connect \ + test_connection_transmit_cancel \ test_os_load \ test_os_network \ test_os_priority \ @@ -207,34 +207,34 @@ test_getopt_SOURCES = \ test_getopt_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la -test_network_SOURCES = \ - test_network.c -test_network_LDADD = \ +test_connection_SOURCES = \ + test_connection.c +test_connection_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la -test_network_addressing_SOURCES = \ - test_network_addressing.c -test_network_addressing_LDADD = \ +test_connection_addressing_SOURCES = \ + test_connection_addressing.c +test_connection_addressing_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la -test_network_receive_cancel_SOURCES = \ - test_network_receive_cancel.c -test_network_receive_cancel_LDADD = \ +test_connection_receive_cancel_SOURCES = \ + test_connection_receive_cancel.c +test_connection_receive_cancel_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la -test_network_timeout_SOURCES = \ - test_network_timeout.c -test_network_timeout_LDADD = \ +test_connection_timeout_SOURCES = \ + test_connection_timeout.c +test_connection_timeout_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la -test_network_timeout_no_connect_SOURCES = \ - test_network_timeout_no_connect.c -test_network_timeout_no_connect_LDADD = \ +test_connection_timeout_no_connect_SOURCES = \ + test_connection_timeout_no_connect.c +test_connection_timeout_no_connect_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la -test_network_transmit_cancel_SOURCES = \ - test_network_transmit_cancel.c -test_network_transmit_cancel_LDADD = \ +test_connection_transmit_cancel_SOURCES = \ + test_connection_transmit_cancel.c +test_connection_transmit_cancel_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la test_os_load_SOURCES = \ diff --git a/src/util/network.c b/src/util/connection.c similarity index 98% rename from src/util/network.c rename to src/util/connection.c index 35dfc69ca..eeb99f03c 100644 --- a/src/util/network.c +++ b/src/util/connection.c @@ -19,8 +19,8 @@ */ /** - * @file util/network/network.c - * @brief basic, low-level TCP networking interface + * @file util/connection.c + * @brief TCP connection management * @author Christian Grothoff * * This code is rather complex. Only modify it if you @@ -40,7 +40,7 @@ #include "gnunet_connection_lib.h" #include "gnunet_scheduler_lib.h" -#define DEBUG_NETWORK GNUNET_NO +#define DEBUG_CONNECTION GNUNET_NO /** * List of address families to give as hints to @@ -314,7 +314,7 @@ GNUNET_CONNECTION_create_from_accept (struct GNUNET_SCHEDULER_Handle GNUNET_free (uaddr); return NULL; } -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Accepting connection from `%s'\n"), GNUNET_a2s(uaddr, addrlen)); @@ -439,7 +439,7 @@ try_connect (struct GNUNET_CONNECTION_Handle *sock) GNUNET_break (0 == GNUNET_NETWORK_socket_close (s)); return GNUNET_SYSERR; } -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Trying to connect to `%s'\n"), GNUNET_a2s(sock->ai_pos->ai_addr, @@ -491,7 +491,7 @@ connect_continuation (void *cls, (0 != GNUNET_NETWORK_socket_getsockopt (sock->sock, SOL_SOCKET, SO_ERROR, &error, &len)) || (error != 0) || (errno != 0)) { -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to establish TCP connection to `%s'\n", GNUNET_a2s(sock->addr, sock->addrlen)); @@ -502,7 +502,7 @@ connect_continuation (void *cls, if (GNUNET_SYSERR == try_connect (sock)) { /* failed for good */ -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to establish TCP connection, no further addresses to try.\n"); #endif @@ -522,7 +522,7 @@ connect_continuation (void *cls, return; } /* connect succeeded! clean up "ai" */ -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connection to `%s' succeeded!\n", GNUNET_a2s(sock->addr, sock->addrlen)); @@ -622,7 +622,7 @@ GNUNET_CONNECTION_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle GNUNET_break (0 == GNUNET_NETWORK_socket_close (s)); return NULL; } -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Trying to connect to `%s'\n"), GNUNET_a2s(serv_addr, addrlen)); @@ -681,7 +681,7 @@ destroy_continuation (void *cls, } if (sock->sock != NULL) { -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down socket.\n"); #endif GNUNET_NETWORK_socket_shutdown (sock->sock, SHUT_RDWR); @@ -744,7 +744,7 @@ signal_timeout (struct GNUNET_CONNECTION_Handle *sh) { GNUNET_CONNECTION_Receiver receiver; -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Network signals time out to receiver!\n"); #endif @@ -786,7 +786,7 @@ receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) || (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))) { -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receive encounters error: time out...\n"); #endif @@ -796,7 +796,7 @@ receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (sh->sock == NULL) { /* connect failed for good */ -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receive encounters error, socket closed...\n"); #endif @@ -817,14 +817,14 @@ RETRY: { if (errno == EINTR) goto RETRY; -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error receiving: %s\n", STRERROR (errno)); #endif signal_error (sh, errno); return; } -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "receive_ready read %u/%u bytes from `%s'!\n", (unsigned int) ret, @@ -855,7 +855,7 @@ receive_again (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) (sh->connect_task == GNUNET_SCHEDULER_NO_TASK)) { /* not connected and no longer trying */ -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receive encounters error, socket closed...\n"); #endif @@ -866,7 +866,7 @@ receive_again (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if ((now.value > sh->receive_timeout.value) || (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))) { -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receive encounters error: time out...\n"); #endif @@ -1013,7 +1013,7 @@ transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_CONNECTION_Handle *sock = cls; GNUNET_CONNECTION_TransmitReadyNotify notify; -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmit fails, time out reached.\n"); #endif notify = sock->nth.notify_ready; @@ -1068,7 +1068,7 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) && (!GNUNET_NETWORK_fdset_isset (tc->write_ready, sock->sock))) ) { -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Could not satisfy pending transmission request, socket closed or connect failed.\n")); #endif @@ -1111,7 +1111,7 @@ RETRY: { if (errno == EINTR) goto RETRY; -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "send"); #endif GNUNET_NETWORK_socket_shutdown (sock->sock, SHUT_RDWR); @@ -1120,7 +1120,7 @@ RETRY: transmit_error (sock); return; } -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "transmit_ready transmitted %u/%u bytes to `%s'\n", (unsigned int) ret, @@ -1178,7 +1178,7 @@ GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle if ((sock->sock == NULL) && (sock->connect_task == GNUNET_SCHEDULER_NO_TASK)) { -#if DEBUG_NETWORK +#if DEBUG_CONNECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission request of size %u fails, connection failed.\n", size); @@ -1244,3 +1244,5 @@ GNUNET_CONNECTION_notify_transmit_ready_cancel (struct #ifdef __cplusplus } #endif + +/* end of connection.c */ diff --git a/src/util/test_network.c b/src/util/test_connection.c similarity index 97% rename from src/util/test_network.c rename to src/util/test_connection.c index 712167b99..3ca09281d 100644 --- a/src/util/test_network.c +++ b/src/util/test_connection.c @@ -18,8 +18,8 @@ Boston, MA 02111-1307, USA. */ /** - * @file util/test_network.c - * @brief tests for network.c + * @file util/test_connection.c + * @brief tests for connection.c */ #include "platform.h" #include "gnunet_common.h" @@ -196,7 +196,7 @@ main (int argc, char *argv[]) { int ret = 0; - GNUNET_log_setup ("test_network", + GNUNET_log_setup ("test_connection", #if VERBOSE "DEBUG", #else @@ -207,4 +207,4 @@ main (int argc, char *argv[]) return ret; } -/* end of test_network.c */ +/* end of test_connection.c */ diff --git a/src/util/test_network_addressing.c b/src/util/test_connection_addressing.c similarity index 97% rename from src/util/test_network_addressing.c rename to src/util/test_connection_addressing.c index 3b96dd06e..650b716af 100644 --- a/src/util/test_network_addressing.c +++ b/src/util/test_connection_addressing.c @@ -18,8 +18,8 @@ Boston, MA 02111-1307, USA. */ /** - * @file util/test_network_addressing.c - * @brief tests for network.c + * @file util/test_connection_addressing.c + * @brief tests for connection.c */ #include "platform.h" #include "gnunet_common.h" @@ -186,7 +186,7 @@ main (int argc, char *argv[]) { int ret = 0; - GNUNET_log_setup ("test_network_addressing", + GNUNET_log_setup ("test_connection_addressing", #if VERBOSE "DEBUG", #else @@ -197,4 +197,4 @@ main (int argc, char *argv[]) return ret; } -/* end of test_network_addressing.c */ +/* end of test_connection_addressing.c */ diff --git a/src/util/test_network_receive_cancel.c b/src/util/test_connection_receive_cancel.c similarity index 95% rename from src/util/test_network_receive_cancel.c rename to src/util/test_connection_receive_cancel.c index 511bf9f22..338caa737 100644 --- a/src/util/test_network_receive_cancel.c +++ b/src/util/test_connection_receive_cancel.c @@ -18,8 +18,8 @@ Boston, MA 02111-1307, USA. */ /** - * @file util/test_network_receive_cancel.c - * @brief tests for network.c + * @file util/test_connection_receive_cancel.c + * @brief tests for connection.c */ #include "platform.h" #include "gnunet_common.h" @@ -155,10 +155,10 @@ main (int argc, char *argv[]) { int ret = 0; - GNUNET_log_setup ("test_network_receive_cancel", "WARNING", NULL); + GNUNET_log_setup ("test_connection_receive_cancel", "WARNING", NULL); ret += check_receive_cancel (); return ret; } -/* end of test_network.c */ +/* end of test_connection_receive_cancel.c */ diff --git a/src/util/test_network_timeout.c b/src/util/test_connection_timeout.c similarity index 96% rename from src/util/test_network_timeout.c rename to src/util/test_connection_timeout.c index 69aff307a..61d9a2d07 100644 --- a/src/util/test_network_timeout.c +++ b/src/util/test_connection_timeout.c @@ -18,8 +18,8 @@ Boston, MA 02111-1307, USA. */ /** - * @file util/test_network_timeout.c - * @brief tests for network.c + * @file util/test_connection_timeout.c + * @brief tests for connection.c */ #include "platform.h" #include "gnunet_common.h" @@ -130,7 +130,7 @@ main (int argc, char *argv[]) { int ret = 0; - GNUNET_log_setup ("test_network_timeout", + GNUNET_log_setup ("test_connection_timeout", #if VERBOSE "DEBUG", #else @@ -141,4 +141,4 @@ main (int argc, char *argv[]) return ret; } -/* end of test_network_timeout.c */ +/* end of test_connection_timeout.c */ diff --git a/src/util/test_network_timeout_no_connect.c b/src/util/test_connection_timeout_no_connect.c similarity index 90% rename from src/util/test_network_timeout_no_connect.c rename to src/util/test_connection_timeout_no_connect.c index c0e1b5e4d..6a6d32f38 100644 --- a/src/util/test_network_timeout_no_connect.c +++ b/src/util/test_connection_timeout_no_connect.c @@ -18,8 +18,8 @@ Boston, MA 02111-1307, USA. */ /** - * @file util/test_network_timeout.c - * @brief tests for network.c, doing timeout which connect failure + * @file util/test_connection_timeout_no_connect.c + * @brief tests for connection.c, doing timeout which connect failure */ #include "platform.h" #include "gnunet_common.h" @@ -81,7 +81,7 @@ main (int argc, char *argv[]) { int ret = 0; - GNUNET_log_setup ("test_network_timeout_no_connect", + GNUNET_log_setup ("test_connection_timeout_no_connect", #if VERBOSE "DEBUG", #else @@ -92,4 +92,4 @@ main (int argc, char *argv[]) return ret; } -/* end of test_network_timeout_no_connect.c */ +/* end of test_connection_timeout_no_connect.c */ diff --git a/src/util/test_network_transmit_cancel.c b/src/util/test_connection_transmit_cancel.c similarity index 92% rename from src/util/test_network_transmit_cancel.c rename to src/util/test_connection_transmit_cancel.c index 362f29a59..642ea0d4c 100644 --- a/src/util/test_network_transmit_cancel.c +++ b/src/util/test_connection_transmit_cancel.c @@ -18,8 +18,8 @@ Boston, MA 02111-1307, USA. */ /** - * @file util/test_network_transmit_cancel.c - * @brief tests for network.c + * @file util/test_connection_transmit_cancel.c + * @brief tests for connection.c */ #include "platform.h" #include "gnunet_common.h" @@ -82,7 +82,7 @@ main (int argc, char *argv[]) { int ret = 0; - GNUNET_log_setup ("test_network_transmit_cancel", + GNUNET_log_setup ("test_connection_transmit_cancel", #if VERBOSE "DEBUG", #else @@ -94,4 +94,4 @@ main (int argc, char *argv[]) return ret; } -/* end of test_network_transmit_cancel.c */ +/* end of test_connection_transmit_cancel.c */ -- 2.25.1