aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-19 23:26:57 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-19 23:26:57 +0100
commitc2d8966687f4c1b88c9fee8ce8913a51c4bb0f83 (patch)
treedb3ba8dd37e2b1abdff6fbe1a239cd567538cb85 /src/transport/gnunet-service-transport.c
parent3902d240e408e85f08d9c444356eb18fc6ea44e7 (diff)
downloadgnunet-c2d8966687f4c1b88c9fee8ce8913a51c4bb0f83.tar.gz
gnunet-c2d8966687f4c1b88c9fee8ce8913a51c4bb0f83.zip
misc log fixes, plus prevent multiple TCP connections from wrecking havoc by creating a missunderstanding about which one is active
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index e7b221344..ec4d82164 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -150,11 +150,11 @@ struct TransportClient
150 150
151 /** 151 /**
152 * What type of client is this? 152 * What type of client is this?
153 */ 153 */
154 enum ClientType type; 154 enum ClientType type;
155 155
156 union { 156 union {
157 157
158 /** 158 /**
159 * Peer identity to monitor the addresses of. 159 * Peer identity to monitor the addresses of.
160 * Zero to monitor all neighbours. Valid if 160 * Zero to monitor all neighbours. Valid if
@@ -172,21 +172,21 @@ struct TransportClient
172 * if we're performing one that has been cancelled). 172 * if we're performing one that has been cancelled).
173 */ 173 */
174 struct GST_BlacklistCheck *bc; 174 struct GST_BlacklistCheck *bc;
175 175
176 /** 176 /**
177 * Set to #GNUNET_YES if we're currently waiting for a reply. 177 * Set to #GNUNET_YES if we're currently waiting for a reply.
178 */ 178 */
179 int waiting_for_reply; 179 int waiting_for_reply;
180 180
181 /** 181 /**
182 * #GNUNET_YES if we have to call receive_done for this client 182 * #GNUNET_YES if we have to call receive_done for this client
183 */ 183 */
184 int call_receive_done; 184 int call_receive_done;
185 185
186 } blacklist; 186 } blacklist;
187 187
188 } details; 188 } details;
189 189
190}; 190};
191 191
192 192
@@ -272,7 +272,7 @@ struct AddressToStringContext
272 */ 272 */
273struct SendTransmitContinuationContext 273struct SendTransmitContinuationContext
274{ 274{
275 275
276 /** 276 /**
277 * Client that made the request. 277 * Client that made the request.
278 */ 278 */
@@ -563,7 +563,7 @@ client_disconnect_cb (void *cls,
563 bc); 563 bc);
564 } 564 }
565 break; 565 break;
566 } 566 }
567 GNUNET_free (tc); 567 GNUNET_free (tc);
568} 568}
569 569
@@ -793,7 +793,7 @@ handle_client_send (void *cls,
793 const struct OutboundMessage *obm) 793 const struct OutboundMessage *obm)
794{ 794{
795 static unsigned long long uuid_gen; 795 static unsigned long long uuid_gen;
796 struct TransportClient *tc = cls; 796 struct TransportClient *tc = cls;
797 const struct GNUNET_MessageHeader *obmm; 797 const struct GNUNET_MessageHeader *obmm;
798 struct SendTransmitContinuationContext *stcc; 798 struct SendTransmitContinuationContext *stcc;
799 799
@@ -937,7 +937,7 @@ check_client_address_to_string (void *cls,
937 return GNUNET_SYSERR; 937 return GNUNET_SYSERR;
938 } 938 }
939 return GNUNET_OK; 939 return GNUNET_OK;
940} 940}
941 941
942 942
943/** 943/**
@@ -950,7 +950,7 @@ static void
950handle_client_address_to_string (void *cls, 950handle_client_address_to_string (void *cls,
951 const struct AddressLookupMessage *alum) 951 const struct AddressLookupMessage *alum)
952{ 952{
953 struct TransportClient *tc = cls; 953 struct TransportClient *tc = cls;
954 struct GNUNET_TRANSPORT_PluginFunctions *papi; 954 struct GNUNET_TRANSPORT_PluginFunctions *papi;
955 const char *plugin_name; 955 const char *plugin_name;
956 const char *address; 956 const char *address;
@@ -1308,7 +1308,7 @@ handle_client_monitor_plugins (void *cls,
1308 const struct GNUNET_MessageHeader *message) 1308 const struct GNUNET_MessageHeader *message)
1309{ 1309{
1310 struct TransportClient *tc = cls; 1310 struct TransportClient *tc = cls;
1311 1311
1312 GNUNET_SERVICE_client_mark_monitor (tc->client); 1312 GNUNET_SERVICE_client_mark_monitor (tc->client);
1313 GNUNET_SERVICE_client_disable_continue_warning (tc->client); 1313 GNUNET_SERVICE_client_disable_continue_warning (tc->client);
1314 GNUNET_notification_context_add (plugin_nc, 1314 GNUNET_notification_context_add (plugin_nc,
@@ -1690,9 +1690,10 @@ GST_receive_callback (void *cls,
1690 goto end; 1690 goto end;
1691 type = ntohs (message->type); 1691 type = ntohs (message->type);
1692 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1692 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1693 "Received message with type %u from peer `%s'\n", 1693 "Received message with type %u from peer `%s' at %s\n",
1694 type, 1694 type,
1695 GNUNET_i2s (&address->peer)); 1695 GNUNET_i2s (&address->peer),
1696 GST_plugins_a2s (address));
1696 1697
1697 GNUNET_STATISTICS_update (GST_stats, 1698 GNUNET_STATISTICS_update (GST_stats,
1698 gettext_noop ("# bytes total received"), 1699 gettext_noop ("# bytes total received"),
@@ -2226,7 +2227,7 @@ handle_client_set_metric (void *cls,
2226 const struct TrafficMetricMessage *tm) 2227 const struct TrafficMetricMessage *tm)
2227{ 2228{
2228 struct TransportClient *tc = cls; 2229 struct TransportClient *tc = cls;
2229 2230
2230 GST_manipulation_set_metric (tm); 2231 GST_manipulation_set_metric (tm);
2231 GNUNET_SERVICE_client_continue (tc->client); 2232 GNUNET_SERVICE_client_continue (tc->client);
2232} 2233}
@@ -2375,7 +2376,7 @@ handle_client_blacklist_reply (void *cls,
2375 bc = tc->details.blacklist.bc; 2376 bc = tc->details.blacklist.bc;
2376 tc->details.blacklist.bc = NULL; 2377 tc->details.blacklist.bc = NULL;
2377 tc->details.blacklist.waiting_for_reply = GNUNET_NO; 2378 tc->details.blacklist.waiting_for_reply = GNUNET_NO;
2378 tc->details.blacklist.call_receive_done = GNUNET_YES; 2379 tc->details.blacklist.call_receive_done = GNUNET_YES;
2379 if (NULL != bc) 2380 if (NULL != bc)
2380 { 2381 {
2381 /* only run this if the blacklist check has not been 2382 /* only run this if the blacklist check has not been
@@ -2808,7 +2809,7 @@ run (void *cls,
2808#if HAVE_GETRLIMIT 2809#if HAVE_GETRLIMIT
2809 { 2810 {
2810 struct rlimit r_file; 2811 struct rlimit r_file;
2811 2812
2812 if (0 == getrlimit (RLIMIT_NOFILE, 2813 if (0 == getrlimit (RLIMIT_NOFILE,
2813 &r_file)) 2814 &r_file))
2814 { 2815 {
@@ -2893,7 +2894,7 @@ GNUNET_SERVICE_MAIN
2893 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, 2894 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND,
2894 struct OutboundMessage, 2895 struct OutboundMessage,
2895 NULL), 2896 NULL),
2896 GNUNET_MQ_hd_var_size (client_address_to_string, 2897 GNUNET_MQ_hd_var_size (client_address_to_string,
2897 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, 2898 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING,
2898 struct AddressLookupMessage, 2899 struct AddressLookupMessage,
2899 NULL), 2900 NULL),
@@ -2913,7 +2914,7 @@ GNUNET_SERVICE_MAIN
2913 GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC, 2914 GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC,
2914 struct TrafficMetricMessage, 2915 struct TrafficMetricMessage,
2915 NULL), 2916 NULL),
2916 GNUNET_MQ_hd_fixed_size (client_monitor_plugins, 2917 GNUNET_MQ_hd_fixed_size (client_monitor_plugins,
2917 GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_START, 2918 GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_START,
2918 struct GNUNET_MessageHeader, 2919 struct GNUNET_MessageHeader,
2919 NULL), 2920 NULL),