diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-26 20:46:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-26 20:46:05 +0000 |
commit | a89ea716333ad5ad43757a946efc01cb5e95a0c0 (patch) | |
tree | 734846d7f0d45efae4db000c34c882e868ce5c81 /src | |
parent | 4f3250dfb068d6f378f4d504e06a9126d9dac99b (diff) | |
download | gnunet-a89ea716333ad5ad43757a946efc01cb5e95a0c0.tar.gz gnunet-a89ea716333ad5ad43757a946efc01cb5e95a0c0.zip |
-indentation, logging, style issues
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 3 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 69 | ||||
-rw-r--r-- | src/transport/transport_api_core.c | 7 |
3 files changed, 43 insertions, 36 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 02d2428d3..9323b18c3 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -1383,7 +1383,8 @@ GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, | |||
1383 | } | 1383 | } |
1384 | if (GNUNET_NO == done) | 1384 | if (GNUNET_NO == done) |
1385 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1385 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1386 | "Message not delivered, is CORE service up?\n"); | 1386 | "Message of type %u not delivered, is CORE service up?\n", |
1387 | ntohs (msg->type)); | ||
1387 | } | 1388 | } |
1388 | 1389 | ||
1389 | 1390 | ||
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index aab4f71e5..2614c8551 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -516,6 +516,41 @@ print_ack_state (enum GST_ACK_State s) | |||
516 | 516 | ||
517 | 517 | ||
518 | /** | 518 | /** |
519 | * Send information about a new outbound quota to our clients. | ||
520 | * Note that the outbound quota is enforced client-side (i.e. | ||
521 | * in libgnunettransport). | ||
522 | * | ||
523 | * @param n affected peer | ||
524 | */ | ||
525 | static void | ||
526 | send_outbound_quota_to_clients (struct NeighbourMapEntry *n) | ||
527 | { | ||
528 | struct QuotaSetMessage q_msg; | ||
529 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min; | ||
530 | |||
531 | if (! GNUNET_TRANSPORT_is_connected (n->state)) | ||
532 | return; | ||
533 | #if IGNORE_INBOUND_QUOTA | ||
534 | bandwidth_min = n->primary_address.bandwidth_out; | ||
535 | #else | ||
536 | bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out, | ||
537 | n->neighbour_receive_quota); | ||
538 | #endif | ||
539 | |||
540 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
541 | "Sending outbound quota of %u Bps for peer `%s' to all clients\n", | ||
542 | ntohl (bandwidth_min.value__), | ||
543 | GNUNET_i2s (&n->id)); | ||
544 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); | ||
545 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); | ||
546 | q_msg.quota = bandwidth_min; | ||
547 | q_msg.peer = n->id; | ||
548 | GST_clients_broadcast (&q_msg.header, | ||
549 | GNUNET_NO); | ||
550 | } | ||
551 | |||
552 | |||
553 | /** | ||
519 | * Notify our clients that another peer connected to us. | 554 | * Notify our clients that another peer connected to us. |
520 | * | 555 | * |
521 | * @param n the peer that connected | 556 | * @param n the peer that connected |
@@ -628,40 +663,6 @@ test_connected (struct NeighbourMapEntry *n) | |||
628 | 663 | ||
629 | 664 | ||
630 | /** | 665 | /** |
631 | * Send information about a new outbound quota to our clients. | ||
632 | * Note that the outbound quota is enforced client-side (i.e. | ||
633 | * in libgnunettransport). | ||
634 | * | ||
635 | * @param n affected peer | ||
636 | */ | ||
637 | static void | ||
638 | send_outbound_quota_to_clients (struct NeighbourMapEntry *n) | ||
639 | { | ||
640 | struct QuotaSetMessage q_msg; | ||
641 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min; | ||
642 | |||
643 | if (! GNUNET_TRANSPORT_is_connected (n->state)) | ||
644 | return; | ||
645 | #if IGNORE_INBOUND_QUOTA | ||
646 | bandwidth_min = n->primary_address.bandwidth_out; | ||
647 | #else | ||
648 | bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out, | ||
649 | n->neighbour_receive_quota); | ||
650 | #endif | ||
651 | |||
652 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
653 | "Sending outbound quota of %u Bps for peer `%s' to all clients\n", | ||
654 | ntohl (bandwidth_min.value__), | ||
655 | GNUNET_i2s (&n->id)); | ||
656 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); | ||
657 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); | ||
658 | q_msg.quota = bandwidth_min; | ||
659 | q_msg.peer = n->id; | ||
660 | GST_clients_broadcast (&q_msg.header, GNUNET_NO); | ||
661 | } | ||
662 | |||
663 | |||
664 | /** | ||
665 | * We don't need a given neighbour address any more. | 666 | * We don't need a given neighbour address any more. |
666 | * Release its resources and give appropriate notifications | 667 | * Release its resources and give appropriate notifications |
667 | * to ATS and other subsystems. | 668 | * to ATS and other subsystems. |
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c index 4ca62d797..6be9500fb 100644 --- a/src/transport/transport_api_core.c +++ b/src/transport/transport_api_core.c | |||
@@ -228,6 +228,10 @@ notify_excess_cb (void *cls) | |||
228 | struct Neighbour *n = cls; | 228 | struct Neighbour *n = cls; |
229 | struct GNUNET_TRANSPORT_CoreHandle *h = n->h; | 229 | struct GNUNET_TRANSPORT_CoreHandle *h = n->h; |
230 | 230 | ||
231 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
232 | "Notifying CORE that more bandwidth is available for %s\n", | ||
233 | GNUNET_i2s (&n->id)); | ||
234 | |||
231 | if (NULL != h->neb_cb) | 235 | if (NULL != h->neb_cb) |
232 | h->neb_cb (h->cls, | 236 | h->neb_cb (h->cls, |
233 | &n->id, | 237 | &n->id, |
@@ -719,7 +723,8 @@ handle_set_quota (void *cls, | |||
719 | struct GNUNET_TRANSPORT_CoreHandle *h = cls; | 723 | struct GNUNET_TRANSPORT_CoreHandle *h = cls; |
720 | struct Neighbour *n; | 724 | struct Neighbour *n; |
721 | 725 | ||
722 | n = neighbour_find (h, &qm->peer); | 726 | n = neighbour_find (h, |
727 | &qm->peer); | ||
723 | if (NULL == n) | 728 | if (NULL == n) |
724 | { | 729 | { |
725 | GNUNET_break (0); | 730 | GNUNET_break (0); |