diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-02-09 18:58:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-02-09 18:58:36 +0000 |
commit | cca6080579e6c7b1be3bff72a31a528779177fb6 (patch) | |
tree | edc7c4c851eedf0298ae9f1501726a332aa8451d /src/transport/transport_api.c | |
parent | e0a17cc294317482060b695b7569d5bdd3b01c2f (diff) | |
download | gnunet-cca6080579e6c7b1be3bff72a31a528779177fb6.tar.gz gnunet-cca6080579e6c7b1be3bff72a31a528779177fb6.zip |
-eliminate odd global variable, indentation, doxygen, stylistic fixes
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r-- | src/transport/transport_api.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 1acf14d41..fb2623f24 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -419,19 +419,26 @@ neighbour_find (struct GNUNET_TRANSPORT_Handle *h, | |||
419 | } | 419 | } |
420 | 420 | ||
421 | 421 | ||
422 | 422 | /** | |
423 | * The outbound quota has changed in a way that may require | ||
424 | * us to reset the timeout. Update the timeout. | ||
425 | * | ||
426 | * @param cls the `struct Neighbour` for which the timeout changed | ||
427 | */ | ||
423 | static void | 428 | static void |
424 | outbound_bw_tracker_update (void *cls) | 429 | outbound_bw_tracker_update (void *cls) |
425 | { | 430 | { |
426 | struct Neighbour *n = cls; | 431 | struct Neighbour *n = cls; |
427 | struct GNUNET_TIME_Relative delay; | 432 | struct GNUNET_TIME_Relative delay; |
433 | |||
428 | if (NULL == n->hn) | 434 | if (NULL == n->hn) |
429 | return; | 435 | return; |
430 | |||
431 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, | 436 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, |
432 | n->th->notify_size + n->traffic_overhead); | 437 | n->th->notify_size + n->traffic_overhead); |
433 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 438 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
434 | "New outbound delay %llu us\n",delay.rel_value_us); | 439 | "New outbound delay %llu us\n", |
440 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
441 | GNUNET_NO)); | ||
435 | GNUNET_CONTAINER_heap_update_cost (n->h->ready_heap, | 442 | GNUNET_CONTAINER_heap_update_cost (n->h->ready_heap, |
436 | n->hn, delay.rel_value_us); | 443 | n->hn, delay.rel_value_us); |
437 | schedule_transmission (n->h); | 444 | schedule_transmission (n->h); |
@@ -517,7 +524,6 @@ neighbour_delete (void *cls, | |||
517 | return GNUNET_YES; | 524 | return GNUNET_YES; |
518 | } | 525 | } |
519 | 526 | ||
520 | static int reconnecting; | ||
521 | 527 | ||
522 | /** | 528 | /** |
523 | * Function we use for handling incoming messages. | 529 | * Function we use for handling incoming messages. |
@@ -544,7 +550,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) | |||
544 | uint32_t bytes_physical; | 550 | uint32_t bytes_physical; |
545 | 551 | ||
546 | GNUNET_assert (NULL != h->client); | 552 | GNUNET_assert (NULL != h->client); |
547 | if (GNUNET_YES == reconnecting) | 553 | if (GNUNET_YES == h->reconnecting) |
548 | { | 554 | { |
549 | return; | 555 | return; |
550 | } | 556 | } |
@@ -552,7 +558,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) | |||
552 | { | 558 | { |
553 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 559 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
554 | "Error receiving from transport service, disconnecting temporarily.\n"); | 560 | "Error receiving from transport service, disconnecting temporarily.\n"); |
555 | reconnecting = GNUNET_YES; | 561 | h->reconnecting = GNUNET_YES; |
556 | disconnect_and_schedule_reconnect (h); | 562 | disconnect_and_schedule_reconnect (h); |
557 | return; | 563 | return; |
558 | } | 564 | } |
@@ -1052,7 +1058,7 @@ reconnect (void *cls, | |||
1052 | GNUNET_assert (NULL == h->client); | 1058 | GNUNET_assert (NULL == h->client); |
1053 | GNUNET_assert (NULL == h->control_head); | 1059 | GNUNET_assert (NULL == h->control_head); |
1054 | GNUNET_assert (NULL == h->control_tail); | 1060 | GNUNET_assert (NULL == h->control_tail); |
1055 | reconnecting = GNUNET_NO; | 1061 | h->reconnecting = GNUNET_NO; |
1056 | h->client = GNUNET_CLIENT_connect ("transport", h->cfg); | 1062 | h->client = GNUNET_CLIENT_connect ("transport", h->cfg); |
1057 | 1063 | ||
1058 | GNUNET_assert (NULL != h->client); | 1064 | GNUNET_assert (NULL != h->client); |
@@ -1140,7 +1146,7 @@ send_try_connect (void *cls, size_t size, void *buf) | |||
1140 | struct GNUNET_TRANSPORT_TryConnectHandle *tch = cls; | 1146 | struct GNUNET_TRANSPORT_TryConnectHandle *tch = cls; |
1141 | struct TransportRequestConnectMessage msg; | 1147 | struct TransportRequestConnectMessage msg; |
1142 | 1148 | ||
1143 | if (buf == NULL) | 1149 | if (NULL == buf) |
1144 | { | 1150 | { |
1145 | if (NULL != tch->cb) | 1151 | if (NULL != tch->cb) |
1146 | tch->cb (tch->cb_cls, GNUNET_SYSERR); | 1152 | tch->cb (tch->cb_cls, GNUNET_SYSERR); |
@@ -1221,6 +1227,7 @@ GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *t | |||
1221 | GNUNET_free (tch); | 1227 | GNUNET_free (tch); |
1222 | } | 1228 | } |
1223 | 1229 | ||
1230 | |||
1224 | /** | 1231 | /** |
1225 | * Send HELLO message to the service. | 1232 | * Send HELLO message to the service. |
1226 | * | 1233 | * |
@@ -1359,7 +1366,6 @@ GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle, | |||
1359 | } | 1366 | } |
1360 | 1367 | ||
1361 | 1368 | ||
1362 | |||
1363 | /** | 1369 | /** |
1364 | * Offer the transport service the HELLO of another peer. Note that | 1370 | * Offer the transport service the HELLO of another peer. Note that |
1365 | * the transport service may just ignore this message if the HELLO is | 1371 | * the transport service may just ignore this message if the HELLO is |
@@ -1628,10 +1634,10 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) | |||
1628 | } | 1634 | } |
1629 | GNUNET_free_non_null (handle->my_hello); | 1635 | GNUNET_free_non_null (handle->my_hello); |
1630 | handle->my_hello = NULL; | 1636 | handle->my_hello = NULL; |
1631 | GNUNET_assert (handle->tc_head == NULL); | 1637 | GNUNET_assert (NULL == handle->tc_head); |
1632 | GNUNET_assert (handle->tc_tail == NULL); | 1638 | GNUNET_assert (NULL == handle->tc_tail); |
1633 | GNUNET_assert (handle->hwl_head == NULL); | 1639 | GNUNET_assert (NULL == handle->hwl_head); |
1634 | GNUNET_assert (handle->hwl_tail == NULL); | 1640 | GNUNET_assert (NULL == handle->hwl_tail); |
1635 | GNUNET_CONTAINER_heap_destroy (handle->ready_heap); | 1641 | GNUNET_CONTAINER_heap_destroy (handle->ready_heap); |
1636 | handle->ready_heap = NULL; | 1642 | handle->ready_heap = NULL; |
1637 | GNUNET_free (handle); | 1643 | GNUNET_free (handle); |