diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-10 16:45:26 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-10 16:45:26 +0000 |
commit | 75264ef067a70a1b0c01dcab46264d4f31217a5f (patch) | |
tree | 690c7ade80810c6cb33bd83e1562d30ca2a0fd06 /src/transport/gnunet-service-transport_neighbours.c | |
parent | 6cf96e80986552390556f36bd6e464d48c1a4b88 (diff) | |
download | gnunet-75264ef067a70a1b0c01dcab46264d4f31217a5f.tar.gz gnunet-75264ef067a70a1b0c01dcab46264d4f31217a5f.zip |
-fixing some memory leaks from #3667, also reindentation and code cleanup
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 9316169a1..5cfb5ed6d 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -1034,7 +1034,7 @@ send_with_session (struct NeighbourMapEntry *n, | |||
1034 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 1034 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
1035 | struct GNUNET_TIME_Relative result = GNUNET_TIME_UNIT_FOREVER_REL; | 1035 | struct GNUNET_TIME_Relative result = GNUNET_TIME_UNIT_FOREVER_REL; |
1036 | 1036 | ||
1037 | GNUNET_assert (n->primary_address.session != NULL); | 1037 | GNUNET_assert (NULL != n->primary_address.session); |
1038 | if ( ((NULL == (papi = GST_plugins_find (n->primary_address.address->transport_name)) || | 1038 | if ( ((NULL == (papi = GST_plugins_find (n->primary_address.address->transport_name)) || |
1039 | (-1 == papi->send (papi->cls, | 1039 | (-1 == papi->send (papi->cls, |
1040 | n->primary_address.session, | 1040 | n->primary_address.session, |
@@ -1561,7 +1561,8 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour, | |||
1561 | : (uint32_t) latency.rel_value_us ); | 1561 | : (uint32_t) latency.rel_value_us ); |
1562 | GST_ats_update_metrics (n->primary_address.address, | 1562 | GST_ats_update_metrics (n->primary_address.address, |
1563 | n->primary_address.session, | 1563 | n->primary_address.session, |
1564 | &ats, 1); | 1564 | &ats, |
1565 | 1); | ||
1565 | } | 1566 | } |
1566 | 1567 | ||
1567 | 1568 | ||
@@ -1680,14 +1681,20 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, | |||
1680 | { | 1681 | { |
1681 | GNUNET_break (0); | 1682 | GNUNET_break (0); |
1682 | if (NULL != cont) | 1683 | if (NULL != cont) |
1683 | cont (cont_cls, GNUNET_SYSERR, msg_size, 0); | 1684 | cont (cont_cls, |
1685 | GNUNET_SYSERR, | ||
1686 | msg_size, | ||
1687 | 0); | ||
1684 | return; | 1688 | return; |
1685 | } | 1689 | } |
1686 | if (GNUNET_YES != test_connected (n)) | 1690 | if (GNUNET_YES != test_connected (n)) |
1687 | { | 1691 | { |
1688 | GNUNET_break (0); | 1692 | GNUNET_break (0); |
1689 | if (NULL != cont) | 1693 | if (NULL != cont) |
1690 | cont (cont_cls, GNUNET_SYSERR, msg_size, 0); | 1694 | cont (cont_cls, |
1695 | GNUNET_SYSERR, | ||
1696 | msg_size, | ||
1697 | 0); | ||
1691 | return; | 1698 | return; |
1692 | } | 1699 | } |
1693 | bytes_in_send_queue += msg_size; | 1700 | bytes_in_send_queue += msg_size; |
@@ -1703,10 +1710,13 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, | |||
1703 | mq->message_buf_size = msg_size; | 1710 | mq->message_buf_size = msg_size; |
1704 | mq->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 1711 | mq->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
1705 | 1712 | ||
1706 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Enqueueing %u bytes to send to peer %s\n", | 1713 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1707 | msg_size, GNUNET_i2s (target)); | 1714 | "Enqueueing %u bytes to send to peer %s\n", |
1708 | 1715 | msg_size, | |
1709 | GNUNET_CONTAINER_DLL_insert_tail (n->messages_head, n->messages_tail, mq); | 1716 | GNUNET_i2s (target)); |
1717 | GNUNET_CONTAINER_DLL_insert_tail (n->messages_head, | ||
1718 | n->messages_tail, | ||
1719 | mq); | ||
1710 | if (NULL != n->task) | 1720 | if (NULL != n->task) |
1711 | GNUNET_SCHEDULER_cancel (n->task); | 1721 | GNUNET_SCHEDULER_cancel (n->task); |
1712 | n->task = GNUNET_SCHEDULER_add_now (&master_task, n); | 1722 | n->task = GNUNET_SCHEDULER_add_now (&master_task, n); |
@@ -2814,7 +2824,7 @@ send_utilization_data (void *cls, | |||
2814 | void *value) | 2824 | void *value) |
2815 | { | 2825 | { |
2816 | struct NeighbourMapEntry *n = value; | 2826 | struct NeighbourMapEntry *n = value; |
2817 | struct GNUNET_ATS_Information atsi[4]; | 2827 | struct GNUNET_ATS_Information atsi[2]; |
2818 | uint32_t bps_in; | 2828 | uint32_t bps_in; |
2819 | uint32_t bps_out; | 2829 | uint32_t bps_out; |
2820 | struct GNUNET_TIME_Relative delta; | 2830 | struct GNUNET_TIME_Relative delta; |
@@ -2842,7 +2852,8 @@ send_utilization_data (void *cls, | |||
2842 | atsi[1].value = htonl (bps_in); | 2852 | atsi[1].value = htonl (bps_in); |
2843 | GST_ats_update_metrics (n->primary_address.address, | 2853 | GST_ats_update_metrics (n->primary_address.address, |
2844 | n->primary_address.session, | 2854 | n->primary_address.session, |
2845 | atsi, 2); | 2855 | atsi, |
2856 | 2); | ||
2846 | n->util_total_bytes_recv = 0; | 2857 | n->util_total_bytes_recv = 0; |
2847 | n->util_total_bytes_sent = 0; | 2858 | n->util_total_bytes_sent = 0; |
2848 | n->last_util_transmission = GNUNET_TIME_absolute_get (); | 2859 | n->last_util_transmission = GNUNET_TIME_absolute_get (); |