aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-22 20:02:10 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-22 20:02:10 +0000
commit194669680385bd40ce7c84b11021b21b6ed6d295 (patch)
treedda0c95d15c0956efb37fdf4dc02ff83de10c5e6
parent658f44879747d23c92e30ca004b04e2dddac73d8 (diff)
downloadgnunet-194669680385bd40ce7c84b11021b21b6ed6d295.tar.gz
gnunet-194669680385bd40ce7c84b11021b21b6ed6d295.zip
-doxygen, indentation
-rw-r--r--src/transport/gnunet-service-transport_validation.c46
-rw-r--r--src/transport/transport_api_monitoring.c32
2 files changed, 46 insertions, 32 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 6621ecc67..86172fab3 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -597,9 +597,10 @@ transmit_ping_if_allowed (void *cls,
597 network = papi->get_network (papi->cls, session); 597 network = papi->get_network (papi->cls, session);
598 if (GNUNET_ATS_NET_UNSPECIFIED == network) 598 if (GNUNET_ATS_NET_UNSPECIFIED == network)
599 { 599 {
600 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 600 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
601 "Could not obtain a valid network for `%s' `%s'\n", 601 "Could not obtain a valid network for `%s' `%s'\n",
602 GNUNET_i2s (pid), GST_plugins_a2s (ve->address)); 602 GNUNET_i2s (pid),
603 GST_plugins_a2s (ve->address));
603 GNUNET_break(0); 604 GNUNET_break(0);
604 } 605 }
605 GST_neighbours_notify_data_sent (pid, ve->address, session, tsize); 606 GST_neighbours_notify_data_sent (pid, ve->address, session, tsize);
@@ -607,8 +608,10 @@ transmit_ping_if_allowed (void *cls,
607 else 608 else
608 { 609 {
609 /* Could not get a valid session */ 610 /* Could not get a valid session */
610 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could not get a valid session for `%s' `%s'\n", 611 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
611 GNUNET_i2s (pid), GST_plugins_a2s (ve->address)); 612 "Could not get a valid session for `%s' `%s'\n",
613 GNUNET_i2s (pid),
614 GST_plugins_a2s (ve->address));
612 ret = -1; 615 ret = -1;
613 } 616 }
614 } 617 }
@@ -623,10 +626,10 @@ transmit_ping_if_allowed (void *cls,
623 626
624 ve->network = network; 627 ve->network = network;
625 ve->expecting_pong = GNUNET_YES; 628 ve->expecting_pong = GNUNET_YES;
626 validations_running ++; 629 validations_running++;
627 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 630 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
628 "Validation started, %u validation processes running\n", 631 "Validation started, %u validation processes running\n",
629 validations_running); 632 validations_running);
630 /* Notify about PING sent */ 633 /* Notify about PING sent */
631 validation_entry_changed (ve, GNUNET_TRANSPORT_VS_UPDATE); 634 validation_entry_changed (ve, GNUNET_TRANSPORT_VS_UPDATE);
632 } 635 }
@@ -943,27 +946,30 @@ multicast_pong (void *cls,
943{ 946{
944 struct TransportPongMessage *pong = cls; 947 struct TransportPongMessage *pong = cls;
945 struct GNUNET_TRANSPORT_PluginFunctions *papi; 948 struct GNUNET_TRANSPORT_PluginFunctions *papi;
949 struct Session *session;
946 950
947 papi = GST_plugins_find (address->transport_name); 951 papi = GST_plugins_find (address->transport_name);
948 if (papi == NULL) 952 if (NULL == papi)
949 return; 953 return;
950 954
951 GNUNET_assert (papi->send != NULL); 955 GNUNET_assert (NULL != papi->send);
952 GNUNET_assert (papi->get_session != NULL); 956 GNUNET_assert (NULL != papi->get_session);
953 957 session = papi->get_session(papi->cls, address);
954 struct Session * session = papi->get_session(papi->cls, address); 958 if (NULL == session)
955 if (session == NULL)
956 { 959 {
957 GNUNET_break (0); 960 GNUNET_break (0);
958 return; 961 return;
959 } 962 }
960
961 papi->send (papi->cls, session, 963 papi->send (papi->cls, session,
962 (const char *) pong, ntohs (pong->header.size), 964 (const char *) pong,
963 PONG_PRIORITY, ACCEPTABLE_PING_DELAY, 965 ntohs (pong->header.size),
966 PONG_PRIORITY,
967 ACCEPTABLE_PING_DELAY,
964 NULL, NULL); 968 NULL, NULL);
965 GST_neighbours_notify_data_sent (&address->peer, 969 GST_neighbours_notify_data_sent (&address->peer,
966 address, session, pong->header.size); 970 address,
971 session,
972 pong->header.size);
967 973
968} 974}
969 975
@@ -1197,7 +1203,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
1197 pong->header.size); 1203 pong->header.size);
1198 } 1204 }
1199 } 1205 }
1200 if (ret != -1) 1206 if (-1 != ret)
1201 { 1207 {
1202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1208 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1203 "Transmitted PONG to `%s' via reliable mechanism\n", 1209 "Transmitted PONG to `%s' via reliable mechanism\n",
diff --git a/src/transport/transport_api_monitoring.c b/src/transport/transport_api_monitoring.c
index b44bf51b8..adea00278 100644
--- a/src/transport/transport_api_monitoring.c
+++ b/src/transport/transport_api_monitoring.c
@@ -48,7 +48,7 @@ struct GNUNET_TRANSPORT_PeerMonitoringContext
48 GNUNET_TRANSPORT_PeerIterateCallback cb; 48 GNUNET_TRANSPORT_PeerIterateCallback cb;
49 49
50 /** 50 /**
51 * Closure for cb. 51 * Closure for @e cb.
52 */ 52 */
53 void *cb_cls; 53 void *cb_cls;
54 54
@@ -100,7 +100,7 @@ struct GNUNET_TRANSPORT_ValidationMonitoringContext
100 GNUNET_TRANSPORT_ValidationIterateCallback cb; 100 GNUNET_TRANSPORT_ValidationIterateCallback cb;
101 101
102 /** 102 /**
103 * Closure for cb. 103 * Closure for @e cb.
104 */ 104 */
105 void *cb_cls; 105 void *cb_cls;
106 106
@@ -140,11 +140,12 @@ struct GNUNET_TRANSPORT_ValidationMonitoringContext
140 int one_shot; 140 int one_shot;
141}; 141};
142 142
143
143/** 144/**
144 * Check if a state is defined as connected 145 * Check if a state is defined as connected
145 * 146 *
146 * @param state the state value 147 * @param state the state value
147 * @return GNUNET_YES or GNUNET_NO 148 * @return #GNUNET_YES or #GNUNET_NO
148 */ 149 */
149int 150int
150GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state) 151GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state)
@@ -175,6 +176,7 @@ GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state)
175 return GNUNET_SYSERR; 176 return GNUNET_SYSERR;
176} 177}
177 178
179
178/** 180/**
179 * Convert peer state to human-readable string. 181 * Convert peer state to human-readable string.
180 * 182 *
@@ -214,6 +216,7 @@ GNUNET_TRANSPORT_ps2s (enum GNUNET_TRANSPORT_PeerState state)
214 } 216 }
215} 217}
216 218
219
217/** 220/**
218 * Convert validation state to human-readable string. 221 * Convert validation state to human-readable string.
219 * 222 *
@@ -250,7 +253,8 @@ GNUNET_TRANSPORT_vs2s (enum GNUNET_TRANSPORT_ValidationState state)
250 * message with the human-readable address 253 * message with the human-readable address
251 */ 254 */
252static void 255static void
253peer_response_processor (void *cls, const struct GNUNET_MessageHeader *msg); 256peer_response_processor (void *cls,
257 const struct GNUNET_MessageHeader *msg);
254 258
255 259
256/** 260/**
@@ -261,7 +265,9 @@ peer_response_processor (void *cls, const struct GNUNET_MessageHeader *msg);
261 * message with the human-readable address 265 * message with the human-readable address
262 */ 266 */
263static void 267static void
264val_response_processor (void *cls, const struct GNUNET_MessageHeader *msg); 268val_response_processor (void *cls,
269 const struct GNUNET_MessageHeader *msg);
270
265 271
266/** 272/**
267 * Send our subscription request to the service. 273 * Send our subscription request to the service.
@@ -279,13 +285,14 @@ send_peer_mon_request (struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx)
279 msg.peer = pal_ctx->peer; 285 msg.peer = pal_ctx->peer;
280 GNUNET_assert (GNUNET_OK == 286 GNUNET_assert (GNUNET_OK ==
281 GNUNET_CLIENT_transmit_and_get_response (pal_ctx->client, 287 GNUNET_CLIENT_transmit_and_get_response (pal_ctx->client,
282 &msg.header, 288 &msg.header,
283 GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout), 289 GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout),
284 GNUNET_YES, 290 GNUNET_YES,
285 &peer_response_processor, 291 &peer_response_processor,
286 pal_ctx)); 292 pal_ctx));
287} 293}
288 294
295
289/** 296/**
290 * Send our subscription request to the service. 297 * Send our subscription request to the service.
291 * 298 *
@@ -312,12 +319,12 @@ send_val_mon_request (struct GNUNET_TRANSPORT_ValidationMonitoringContext *val_c
312/** 319/**
313 * Task run to re-establish the connection. 320 * Task run to re-establish the connection.
314 * 321 *
315 * @param cls our 'struct GNUNET_TRANSPORT_PeerAddressLookupContext*' 322 * @param cls our `struct GNUNET_TRANSPORT_PeerAddressLookupContext *`
316 * @param tc scheduler context, unused 323 * @param tc scheduler context, unused
317 */ 324 */
318static void 325static void
319do_peer_connect (void *cls, 326do_peer_connect (void *cls,
320 const struct GNUNET_SCHEDULER_TaskContext *tc) 327 const struct GNUNET_SCHEDULER_TaskContext *tc)
321{ 328{
322 struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls; 329 struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls;
323 330
@@ -367,6 +374,7 @@ do_val_connect (void *cls,
367 send_val_mon_request (val_ctx); 374 send_val_mon_request (val_ctx);
368} 375}
369 376
377
370/** 378/**
371 * Cut the existing connection and reconnect. 379 * Cut the existing connection and reconnect.
372 * 380 *