aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 07c48caba..bdb67dbca 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -401,6 +401,9 @@ static GNUNET_TRANSPORT_PeerIterateCallback address_change_cb;
401 */ 401 */
402static int neighbours_connected; 402static int neighbours_connected;
403 403
404static unsigned int bytes_in_send_queue;
405static unsigned int bytes_received;
406
404/** 407/**
405 * Lookup a neighbour entry in the neighbours hash map. 408 * Lookup a neighbour entry in the neighbours hash map.
406 * 409 *
@@ -710,6 +713,14 @@ transmit_send_continuation (void *cls,
710 n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n); 713 n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n);
711 } 714 }
712 } 715 }
716
717 GNUNET_assert (bytes_in_send_queue >= mq->message_buf_size);
718 bytes_in_send_queue -= mq->message_buf_size;
719 GNUNET_STATISTICS_set (GST_stats,
720 gettext_noop
721 ("# bytes in message queue for other peers"),
722 bytes_in_send_queue, GNUNET_NO);
723
713 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message of type %u was %s\n", 724 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message of type %u was %s\n",
714 ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type), 725 ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type),
715 (success == GNUNET_OK) ? "successful" : "FAILED"); 726 (success == GNUNET_OK) ? "successful" : "FAILED");
@@ -838,6 +849,8 @@ GST_neighbours_start (void *cls,
838 address_change_cb = peer_address_cb; 849 address_change_cb = peer_address_cb;
839 neighbours = GNUNET_CONTAINER_multihashmap_create (NEIGHBOUR_TABLE_SIZE); 850 neighbours = GNUNET_CONTAINER_multihashmap_create (NEIGHBOUR_TABLE_SIZE);
840 neighbours_connected = 0; 851 neighbours_connected = 0;
852 bytes_in_send_queue = 0;
853 bytes_received = 0;
841} 854}
842 855
843 856
@@ -1977,10 +1990,11 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg,
1977 } 1990 }
1978 1991
1979 GNUNET_assert (msg_size >= sizeof (struct GNUNET_MessageHeader)); 1992 GNUNET_assert (msg_size >= sizeof (struct GNUNET_MessageHeader));
1980 GNUNET_STATISTICS_update (GST_stats, 1993 bytes_in_send_queue += msg_size;
1981 gettext_noop 1994 GNUNET_STATISTICS_set (GST_stats,
1982 ("# bytes in message queue for other peers"), 1995 gettext_noop
1983 msg_size, GNUNET_NO); 1996 ("# bytes in message queue for other peers"),
1997 bytes_in_send_queue, GNUNET_NO);
1984 mq = GNUNET_malloc (sizeof (struct MessageQueue) + msg_size); 1998 mq = GNUNET_malloc (sizeof (struct MessageQueue) + msg_size);
1985 mq->cont = cont; 1999 mq->cont = cont;
1986 mq->cont_cls = cont_cls; 2000 mq->cont_cls = cont_cls;