aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-10 16:45:26 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-10 16:45:26 +0000
commit75264ef067a70a1b0c01dcab46264d4f31217a5f (patch)
tree690c7ade80810c6cb33bd83e1562d30ca2a0fd06 /src/transport/gnunet-service-transport.c
parent6cf96e80986552390556f36bd6e464d48c1a4b88 (diff)
downloadgnunet-75264ef067a70a1b0c01dcab46264d4f31217a5f.tar.gz
gnunet-75264ef067a70a1b0c01dcab46264d4f31217a5f.zip
-fixing some memory leaks from #3667, also reindentation and code cleanup
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c59
1 files changed, 5 insertions, 54 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index fcd2a492d..5840eec5e 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -176,7 +176,7 @@ static struct SessionKiller *sk_tail;
176/** 176/**
177 * Interface scanner determines our LAN address range(s). 177 * Interface scanner determines our LAN address range(s).
178 */ 178 */
179static struct GNUNET_ATS_InterfaceScanner *is; 179struct GNUNET_ATS_InterfaceScanner *GST_is;
180 180
181/** 181/**
182 * Head of DLL of blacklist checks we have pending for 182 * Head of DLL of blacklist checks we have pending for
@@ -697,53 +697,6 @@ plugin_env_session_end (void *cls,
697 697
698 698
699/** 699/**
700 * Function that will be called to figure if an address is an loopback,
701 * LAN, WAN etc. address
702 *
703 * @param cls closure
704 * @param addr binary address
705 * @param addrlen length of the @a addr
706 * @return type of the network @a addr belongs to
707 */
708static enum GNUNET_ATS_Network_Type
709plugin_env_address_to_type (void *cls,
710 const struct sockaddr *addr,
711 size_t addrlen)
712{
713 if (NULL == GST_ats)
714 {
715 GNUNET_break(0);
716 return GNUNET_ATS_NET_UNSPECIFIED;
717 }
718 return GNUNET_ATS_scanner_address_get_type (is,
719 addr,
720 addrlen);
721}
722
723
724/**
725 * Function that will be called to update metrics for an address
726 *
727 * @param cls closure
728 * @param address address to update metrics for
729 * @param session the session
730 * @param ats the ats information to update
731 * @param ats_count the number of @a ats elements
732 */
733static void
734plugin_env_update_metrics (void *cls,
735 const struct GNUNET_HELLO_Address *address,
736 struct Session *session,
737 const struct GNUNET_ATS_Information *ats,
738 uint32_t ats_count)
739{
740 GST_ats_update_metrics (address,
741 session,
742 ats, ats_count);
743}
744
745
746/**
747 * Black list check result from blacklist check triggered when a 700 * Black list check result from blacklist check triggered when a
748 * plugin gave us a new session in #plugin_env_session_start(). If 701 * plugin gave us a new session in #plugin_env_session_start(). If
749 * connection to the peer is disallowed, kill the session. 702 * connection to the peer is disallowed, kill the session.
@@ -940,8 +893,8 @@ shutdown_task (void *cls,
940 GST_ats = NULL; 893 GST_ats = NULL;
941 GNUNET_ATS_connectivity_done (GST_ats_connect); 894 GNUNET_ATS_connectivity_done (GST_ats_connect);
942 GST_ats_connect = NULL; 895 GST_ats_connect = NULL;
943 GNUNET_ATS_scanner_done (is); 896 GNUNET_ATS_scanner_done (GST_is);
944 is = NULL; 897 GST_is = NULL;
945 GST_clients_stop (); 898 GST_clients_stop ();
946 GST_blacklist_stop (); 899 GST_blacklist_stop ();
947 GST_hello_stop (); 900 GST_hello_stop ();
@@ -1075,7 +1028,7 @@ run (void *cls,
1075 GST_blacklist_start (GST_server, 1028 GST_blacklist_start (GST_server,
1076 GST_cfg, 1029 GST_cfg,
1077 &GST_my_identity); 1030 &GST_my_identity);
1078 is = GNUNET_ATS_scanner_init (); 1031 GST_is = GNUNET_ATS_scanner_init ();
1079 GST_ats_connect = GNUNET_ATS_connectivity_init (GST_cfg); 1032 GST_ats_connect = GNUNET_ATS_connectivity_init (GST_cfg);
1080 GST_ats = GNUNET_ATS_scheduling_init (GST_cfg, 1033 GST_ats = GNUNET_ATS_scheduling_init (GST_cfg,
1081 &ats_request_address_change, 1034 &ats_request_address_change,
@@ -1085,9 +1038,7 @@ run (void *cls,
1085 GST_plugins_load (&GST_manipulation_recv, 1038 GST_plugins_load (&GST_manipulation_recv,
1086 &plugin_env_address_change_notification, 1039 &plugin_env_address_change_notification,
1087 &plugin_env_session_start, 1040 &plugin_env_session_start,
1088 &plugin_env_session_end, 1041 &plugin_env_session_end);
1089 &plugin_env_address_to_type,
1090 &plugin_env_update_metrics);
1091 GST_neighbours_start ((max_fd / 3) * 2); 1042 GST_neighbours_start ((max_fd / 3) * 2);
1092 GST_clients_start (GST_server); 1043 GST_clients_start (GST_server);
1093 GST_validation_start ((max_fd / 3)); 1044 GST_validation_start ((max_fd / 3));