aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/transport/gnunet-service-transport.c124
-rw-r--r--src/transport/gnunet-service-transport_clients.c6
-rw-r--r--src/transport/plugin_transport_tcp.c5
-rw-r--r--src/util/server.c18
5 files changed, 90 insertions, 64 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8df844ecc..63e34b08a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -361,6 +361,7 @@ src/transport/transport_api_address_to_string.c
361src/transport/transport_api_blacklist.c 361src/transport/transport_api_blacklist.c
362src/transport/transport_api.c 362src/transport/transport_api.c
363src/transport/transport_api_monitor_peers.c 363src/transport/transport_api_monitor_peers.c
364src/transport/transport_api_monitor_plugins.c
364src/transport/transport_api_monitor_validation.c 365src/transport/transport_api_monitor_validation.c
365src/transport/transport-testing.c 366src/transport/transport-testing.c
366src/tun/regex.c 367src/tun/regex.c
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index ba9eb38d8..63f8f9f68 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -732,8 +732,10 @@ GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
732 */ 732 */
733void 733void
734GST_ats_update_metrics (const struct GNUNET_PeerIdentity *peer, 734GST_ats_update_metrics (const struct GNUNET_PeerIdentity *peer,
735 const struct GNUNET_HELLO_Address *address, struct Session *session, 735 const struct GNUNET_HELLO_Address *address,
736 const struct GNUNET_ATS_Information *ats, uint32_t ats_count) 736 struct Session *session,
737 const struct GNUNET_ATS_Information *ats,
738 uint32_t ats_count)
737{ 739{
738 struct GNUNET_ATS_Information *ats_new; 740 struct GNUNET_ATS_Information *ats_new;
739 741
@@ -770,21 +772,27 @@ GST_ats_update_metrics (const struct GNUNET_PeerIdentity *peer,
770 */ 772 */
771static void 773static void
772plugin_env_update_metrics (void *cls, 774plugin_env_update_metrics (void *cls,
773 const struct GNUNET_HELLO_Address *address, 775 const struct GNUNET_HELLO_Address *address,
774 struct Session *session, 776 struct Session *session,
775 const struct GNUNET_ATS_Information *ats, 777 const struct GNUNET_ATS_Information *ats,
776 uint32_t ats_count) 778 uint32_t ats_count)
777{ 779{
778 if ((NULL == ats) || (0 == ats_count)) 780 if ((NULL == ats) || (0 == ats_count))
779 return; 781 return;
780 GNUNET_assert(NULL != GST_ats); 782 GNUNET_assert(NULL != GST_ats);
781 783
782 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 784 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
783 "Updating metrics for peer `%s' address %s session %p\n", 785 "Updating metrics for peer `%s' address %s session %p\n",
784 GNUNET_i2s (&address->peer), GST_plugins_a2s (address), session); 786 GNUNET_i2s (&address->peer),
785 GST_ats_update_metrics (&address->peer, address, session, ats, ats_count); 787 GST_plugins_a2s (address),
788 session);
789 GST_ats_update_metrics (&address->peer,
790 address,
791 session,
792 ats, ats_count);
786} 793}
787 794
795
788/** 796/**
789 * Black list check result for try_connect call 797 * Black list check result for try_connect call
790 * If connection to the peer is allowed request adddress and 798 * If connection to the peer is allowed request adddress and
@@ -829,9 +837,11 @@ plugin_env_session_start_bl_check_cont (void *cls,
829 * @param ats_count number of @a ats information 837 * @param ats_count number of @a ats information
830 */ 838 */
831static void 839static void
832plugin_env_session_start (void *cls, struct GNUNET_HELLO_Address *address, 840plugin_env_session_start (void *cls,
833 struct Session *session, const struct GNUNET_ATS_Information *ats, 841 struct GNUNET_HELLO_Address *address,
834 uint32_t ats_count) 842 struct Session *session,
843 const struct GNUNET_ATS_Information *ats,
844 uint32_t ats_count)
835{ 845{
836 struct BlacklistCheckContext *blctx; 846 struct BlacklistCheckContext *blctx;
837 struct GST_BlacklistCheck *blc; 847 struct GST_BlacklistCheck *blc;
@@ -876,6 +886,7 @@ plugin_env_session_start (void *cls, struct GNUNET_HELLO_Address *address,
876 } 886 }
877} 887}
878 888
889
879/** 890/**
880 * Function called by ATS to notify the callee that the 891 * Function called by ATS to notify the callee that the
881 * assigned bandwidth or address for a given peer was changed. If the 892 * assigned bandwidth or address for a given peer was changed. If the
@@ -896,13 +907,13 @@ plugin_env_session_start (void *cls, struct GNUNET_HELLO_Address *address,
896 */ 907 */
897static void 908static void
898ats_request_address_change (void *cls, 909ats_request_address_change (void *cls,
899 const struct GNUNET_PeerIdentity *peer, 910 const struct GNUNET_PeerIdentity *peer,
900 const struct GNUNET_HELLO_Address *address, 911 const struct GNUNET_HELLO_Address *address,
901 struct Session *session, 912 struct Session *session,
902 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 913 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
903 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 914 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
904 const struct GNUNET_ATS_Information *ats, 915 const struct GNUNET_ATS_Information *ats,
905 uint32_t ats_count) 916 uint32_t ats_count)
906{ 917{
907 uint32_t bw_in = ntohl (bandwidth_in.value__); 918 uint32_t bw_in = ntohl (bandwidth_in.value__);
908 uint32_t bw_out = ntohl (bandwidth_out.value__); 919 uint32_t bw_out = ntohl (bandwidth_out.value__);
@@ -952,6 +963,7 @@ neighbours_connect_notification (void *cls,
952 GST_clients_broadcast (&connect_msg->header, GNUNET_NO); 963 GST_clients_broadcast (&connect_msg->header, GNUNET_NO);
953} 964}
954 965
966
955/** 967/**
956 * Function called to notify transport users that another 968 * Function called to notify transport users that another
957 * peer disconnected from us. 969 * peer disconnected from us.
@@ -961,7 +973,7 @@ neighbours_connect_notification (void *cls,
961 */ 973 */
962static void 974static void
963neighbours_disconnect_notification (void *cls, 975neighbours_disconnect_notification (void *cls,
964 const struct GNUNET_PeerIdentity *peer) 976 const struct GNUNET_PeerIdentity *peer)
965{ 977{
966 struct DisconnectInfoMessage disconnect_msg; 978 struct DisconnectInfoMessage disconnect_msg;
967 979
@@ -978,6 +990,7 @@ neighbours_disconnect_notification (void *cls,
978 GST_clients_broadcast (&disconnect_msg.header, GNUNET_NO); 990 GST_clients_broadcast (&disconnect_msg.header, GNUNET_NO);
979} 991}
980 992
993
981/** 994/**
982 * Function called to notify transport users that a neighbour peer changed its 995 * Function called to notify transport users that a neighbour peer changed its
983 * active address. 996 * active address.
@@ -992,21 +1005,24 @@ neighbours_disconnect_notification (void *cls,
992 */ 1005 */
993static void 1006static void
994neighbours_changed_notification (void *cls, 1007neighbours_changed_notification (void *cls,
995 const struct GNUNET_PeerIdentity *peer, 1008 const struct GNUNET_PeerIdentity *peer,
996 const struct GNUNET_HELLO_Address *address, 1009 const struct GNUNET_HELLO_Address *address,
997 enum GNUNET_TRANSPORT_PeerState state, 1010 enum GNUNET_TRANSPORT_PeerState state,
998 struct GNUNET_TIME_Absolute state_timeout, 1011 struct GNUNET_TIME_Absolute state_timeout,
999 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 1012 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
1000 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) 1013 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
1001{ 1014{
1002 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1015 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1003 "Notifying about change for peer `%s' with address `%s' in state `%s' timing out at %s\n", 1016 "Notifying about change for peer `%s' with address `%s' in state `%s' timing out at %s\n",
1004 GNUNET_i2s (peer), 1017 GNUNET_i2s (peer),
1005 (NULL != address) ? GST_plugins_a2s (address) : "<none>", 1018 (NULL != address) ? GST_plugins_a2s (address) : "<none>",
1006 GNUNET_TRANSPORT_ps2s (state), 1019 GNUNET_TRANSPORT_ps2s (state),
1007 GNUNET_STRINGS_absolute_time_to_string (state_timeout)); 1020 GNUNET_STRINGS_absolute_time_to_string (state_timeout));
1008 1021
1009 GST_clients_broadcast_peer_notification (peer, address, state, state_timeout); 1022 GST_clients_broadcast_peer_notification (peer,
1023 address,
1024 state,
1025 state_timeout);
1010} 1026}
1011 1027
1012 1028
@@ -1049,6 +1065,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1049 GST_server = NULL; 1065 GST_server = NULL;
1050} 1066}
1051 1067
1068
1052/** 1069/**
1053 * Initiate transport service. 1070 * Initiate transport service.
1054 * 1071 *
@@ -1078,16 +1095,18 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1078 GNUNET_SCHEDULER_shutdown (); 1095 GNUNET_SCHEDULER_shutdown ();
1079 return; 1096 return;
1080 } 1097 }
1081 if (GNUNET_OK 1098 if (GNUNET_OK !=
1082 != GNUNET_CONFIGURATION_get_value_time (c, "transport", 1099 GNUNET_CONFIGURATION_get_value_time (c,
1083 "HELLO_EXPIRATION", &hello_expiration)) 1100 "transport",
1101 "HELLO_EXPIRATION",
1102 &hello_expiration))
1084 { 1103 {
1085 hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION; 1104 hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION;
1086 } 1105 }
1087 GST_server = server; 1106 GST_server = server;
1088 pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); 1107 pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile);
1089 GNUNET_free(keyfile); 1108 GNUNET_free (keyfile);
1090 GNUNET_assert(NULL != pk); 1109 GNUNET_assert (NULL != pk);
1091 GST_my_private_key = pk; 1110 GST_my_private_key = pk;
1092 1111
1093 GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg); 1112 GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg);
@@ -1096,8 +1115,9 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1096 &GST_my_identity.public_key); 1115 &GST_my_identity.public_key);
1097 GNUNET_assert(NULL != GST_my_private_key); 1116 GNUNET_assert(NULL != GST_my_private_key);
1098 1117
1099 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "My identity is `%4s'\n", 1118 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
1100 GNUNET_i2s_full (&GST_my_identity)); 1119 "My identity is `%4s'\n",
1120 GNUNET_i2s_full (&GST_my_identity));
1101 1121
1102 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 1122 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
1103 NULL ); 1123 NULL );
@@ -1149,18 +1169,18 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1149 NULL ); 1169 NULL );
1150 GST_manipulation_init (GST_cfg); 1170 GST_manipulation_init (GST_cfg);
1151 GST_plugins_load (&GST_manipulation_recv, 1171 GST_plugins_load (&GST_manipulation_recv,
1152 &GST_neighbours_register_quota_notification, 1172 &GST_neighbours_register_quota_notification,
1153 &GST_neighbours_unregister_quota_notification, 1173 &GST_neighbours_unregister_quota_notification,
1154 &plugin_env_address_change_notification, 1174 &plugin_env_address_change_notification,
1155 &plugin_env_session_start, 1175 &plugin_env_session_start,
1156 &plugin_env_session_end, 1176 &plugin_env_session_end,
1157 &plugin_env_address_to_type, 1177 &plugin_env_address_to_type,
1158 &plugin_env_update_metrics); 1178 &plugin_env_update_metrics);
1159 GST_neighbours_start (NULL, 1179 GST_neighbours_start (NULL,
1160 &neighbours_connect_notification, 1180 &neighbours_connect_notification,
1161 &neighbours_disconnect_notification, 1181 &neighbours_disconnect_notification,
1162 &neighbours_changed_notification, 1182 &neighbours_changed_notification,
1163 (max_fd / 3) * 2); 1183 (max_fd / 3) * 2);
1164 GST_clients_start (GST_server); 1184 GST_clients_start (GST_server);
1165 GST_validation_start ((max_fd / 3)); 1185 GST_validation_start ((max_fd / 3));
1166} 1186}
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index df73affc2..b644cec6e 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -1581,9 +1581,9 @@ GST_clients_unicast (struct GNUNET_SERVER_Client *client,
1581 */ 1581 */
1582void 1582void
1583GST_clients_broadcast_peer_notification (const struct GNUNET_PeerIdentity *peer, 1583GST_clients_broadcast_peer_notification (const struct GNUNET_PeerIdentity *peer,
1584 const struct GNUNET_HELLO_Address *address, 1584 const struct GNUNET_HELLO_Address *address,
1585 enum GNUNET_TRANSPORT_PeerState state, 1585 enum GNUNET_TRANSPORT_PeerState state,
1586 struct GNUNET_TIME_Absolute state_timeout) 1586 struct GNUNET_TIME_Absolute state_timeout)
1587{ 1587{
1588 struct PeerIterateResponseMessage *msg; 1588 struct PeerIterateResponseMessage *msg;
1589 struct MonitoringClient *mc; 1589 struct MonitoringClient *mc;
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index e249b9f08..ba8b5895e 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -2972,15 +2972,14 @@ libgnunet_plugin_transport_tcp_done (void *cls)
2972 &session_disconnect_it, 2972 &session_disconnect_it,
2973 plugin); 2973 plugin);
2974 2974
2975 next = ppc_dll_head; 2975 for (cur = ppc_dll_head; NULL != cur; cur = next)
2976 for (cur = next; NULL != cur; cur = next)
2977 { 2976 {
2978 GNUNET_break (0);
2979 next = cur->next; 2977 next = cur->next;
2980 GNUNET_CONTAINER_DLL_remove (ppc_dll_head, 2978 GNUNET_CONTAINER_DLL_remove (ppc_dll_head,
2981 ppc_dll_tail, 2979 ppc_dll_tail,
2982 cur); 2980 cur);
2983 GNUNET_RESOLVER_request_cancel (cur->resolver_handle); 2981 GNUNET_RESOLVER_request_cancel (cur->resolver_handle);
2982 cur->asc (cur->asc_cls, NULL, GNUNET_OK);
2984 GNUNET_free (cur); 2983 GNUNET_free (cur);
2985 } 2984 }
2986 2985
diff --git a/src/util/server.c b/src/util/server.c
index 7c3829244..8883d212e 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -627,7 +627,7 @@ GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access, void *access_cls,
627/** 627/**
628 * Set the 'monitor' flag on this client. Clients which have been 628 * Set the 'monitor' flag on this client. Clients which have been
629 * marked as 'monitors' won't prevent the server from shutting down 629 * marked as 'monitors' won't prevent the server from shutting down
630 * once 'GNUNET_SERVER_stop_listening' has been invoked. The idea is 630 * once '#GNUNET_SERVER_stop_listening()' has been invoked. The idea is
631 * that for "normal" clients we likely want to allow them to process 631 * that for "normal" clients we likely want to allow them to process
632 * their requests; however, monitor-clients are likely to 'never' 632 * their requests; however, monitor-clients are likely to 'never'
633 * disconnect during shutdown and thus will not be considered when 633 * disconnect during shutdown and thus will not be considered when
@@ -746,7 +746,8 @@ GNUNET_SERVER_stop_listening (struct GNUNET_SERVER_Handle *server)
746{ 746{
747 unsigned int i; 747 unsigned int i;
748 748
749 LOG (GNUNET_ERROR_TYPE_DEBUG, "Server in soft shutdown\n"); 749 LOG (GNUNET_ERROR_TYPE_DEBUG,
750 "Server in soft shutdown\n");
750 if (GNUNET_SCHEDULER_NO_TASK != server->listen_task) 751 if (GNUNET_SCHEDULER_NO_TASK != server->listen_task)
751 { 752 {
752 GNUNET_SCHEDULER_cancel (server->listen_task); 753 GNUNET_SCHEDULER_cancel (server->listen_task);
@@ -779,7 +780,8 @@ GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *server)
779 struct NotifyList *npos; 780 struct NotifyList *npos;
780 unsigned int i; 781 unsigned int i;
781 782
782 LOG (GNUNET_ERROR_TYPE_DEBUG, "Server shutting down.\n"); 783 LOG (GNUNET_ERROR_TYPE_DEBUG,
784 "Server shutting down.\n");
783 if (GNUNET_SCHEDULER_NO_TASK != server->listen_task) 785 if (GNUNET_SCHEDULER_NO_TASK != server->listen_task)
784 { 786 {
785 GNUNET_SCHEDULER_cancel (server->listen_task); 787 GNUNET_SCHEDULER_cancel (server->listen_task);
@@ -1006,12 +1008,16 @@ GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server,
1006 * @param buf buffer with data received from network 1008 * @param buf buffer with data received from network
1007 * @param available number of bytes available in buf 1009 * @param available number of bytes available in buf
1008 * @param addr address of the sender 1010 * @param addr address of the sender
1009 * @param addrlen length of addr 1011 * @param addrlen length of @a addr
1010 * @param errCode code indicating errors receiving, 0 for success 1012 * @param errCode code indicating errors receiving, 0 for success
1011 */ 1013 */
1012static void 1014static void
1013process_incoming (void *cls, const void *buf, size_t available, 1015process_incoming (void *cls,
1014 const struct sockaddr *addr, socklen_t addrlen, int errCode); 1016 const void *buf,
1017 size_t available,
1018 const struct sockaddr *addr,
1019 socklen_t addrlen,
1020 int errCode);
1015 1021
1016 1022
1017/** 1023/**