aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r--src/rps/gnunet-service-rps.c324
1 files changed, 129 insertions, 195 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 8ea10e4ca..555660c04 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -247,6 +247,11 @@ struct PeerContext
247 struct PendingMessage *pending_messages_tail; 247 struct PendingMessage *pending_messages_tail;
248 248
249 /** 249 /**
250 * @brief Task to destroy this context.
251 */
252 struct GNUNET_SCHEDULER_Task *destruction_task;
253
254 /**
250 * This is pobably followed by 'statistical' data (when we first saw 255 * This is pobably followed by 'statistical' data (when we first saw
251 * it, how did we get its ID, how many pushes (in a timeinterval), 256 * it, how did we get its ID, how many pushes (in a timeinterval),
252 * ...) 257 * ...)
@@ -1274,6 +1279,23 @@ Peers_get_channel_flag (const struct GNUNET_PeerIdentity *peer,
1274int 1279int
1275Peers_check_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags); 1280Peers_check_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags);
1276 1281
1282static void
1283destroy_peer (void *cls)
1284{
1285 struct PeerContext *peer_ctx = cls;
1286
1287 GNUNET_assert (NULL != peer_ctx);
1288 peer_ctx->destruction_task = NULL;
1289 Peers_remove_peer (&peer_ctx->peer_id);
1290}
1291
1292static void
1293destroy_channel (void *cls);
1294
1295
1296static void
1297schedule_channel_destruction (struct ChannelCtx *channel_ctx);
1298
1277/** 1299/**
1278 * @brief Remove peer 1300 * @brief Remove peer
1279 * 1301 *
@@ -1298,7 +1320,34 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
1298 "Going to remove peer %s\n", 1320 "Going to remove peer %s\n",
1299 GNUNET_i2s (&peer_ctx->peer_id)); 1321 GNUNET_i2s (&peer_ctx->peer_id));
1300 Peers_unset_peer_flag (peer, Peers_ONLINE); 1322 Peers_unset_peer_flag (peer, Peers_ONLINE);
1323 /* Do we still have to wait for destruction of channels
1324 * or issue the destruction? */
1325 if (NULL != peer_ctx->send_channel_ctx &&
1326 NULL != peer_ctx->send_channel_ctx->destruction_task)
1327 {
1328 GNUNET_SCHEDULER_add_now (destroy_peer, peer_ctx);
1329 return GNUNET_NO;
1330 }
1331 if (NULL != peer_ctx->recv_channel_ctx &&
1332 NULL != peer_ctx->recv_channel_ctx->destruction_task)
1333 {
1334 GNUNET_SCHEDULER_add_now (destroy_peer, peer_ctx);
1335 return GNUNET_NO;
1336 }
1337 if (NULL != peer_ctx->recv_channel_ctx)
1338 {
1339 schedule_channel_destruction (peer_ctx->recv_channel_ctx);
1340 GNUNET_SCHEDULER_add_now (destroy_peer, peer_ctx);
1341 return GNUNET_NO;
1342 }
1343 if (NULL != peer_ctx->send_channel_ctx)
1344 {
1345 schedule_channel_destruction (peer_ctx->send_channel_ctx);
1346 GNUNET_SCHEDULER_add_now (destroy_peer, peer_ctx);
1347 return GNUNET_NO;
1348 }
1301 1349
1350 // TODO this probably leaks memory
1302 GNUNET_array_grow (peer_ctx->pending_ops, peer_ctx->num_pending_ops, 0); 1351 GNUNET_array_grow (peer_ctx->pending_ops, peer_ctx->num_pending_ops, 0);
1303 while (NULL != peer_ctx->pending_messages_head) 1352 while (NULL != peer_ctx->pending_messages_head)
1304 { 1353 {
@@ -1311,6 +1360,7 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
1311 peer_ctx->liveliness_check_pending, 1360 peer_ctx->liveliness_check_pending,
1312 sizeof (struct PendingMessage))) ) 1361 sizeof (struct PendingMessage))) )
1313 { 1362 {
1363 // TODO this may leak memory
1314 peer_ctx->liveliness_check_pending = NULL; 1364 peer_ctx->liveliness_check_pending = NULL;
1315 } 1365 }
1316 remove_pending_message (peer_ctx->pending_messages_head, GNUNET_YES); 1366 remove_pending_message (peer_ctx->pending_messages_head, GNUNET_YES);
@@ -1327,29 +1377,10 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
1327 remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES); 1377 remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES);
1328 peer_ctx->liveliness_check_pending = NULL; 1378 peer_ctx->liveliness_check_pending = NULL;
1329 } 1379 }
1330 channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_SENDING); 1380
1331 if (NULL != peer_ctx->send_channel_ctx && 1381 if (NULL != peer_ctx->destruction_task)
1332 GNUNET_YES != Peers_check_channel_flag (channel_flag, Peers_CHANNEL_DESTROING))
1333 {
1334 LOG (GNUNET_ERROR_TYPE_DEBUG,
1335 "Destroying send channel\n");
1336 GNUNET_CADET_channel_destroy (peer_ctx->send_channel_ctx->channel);
1337 remove_channel_ctx (peer_ctx->send_channel_ctx);
1338 peer_ctx->send_channel_ctx = NULL;
1339 peer_ctx->mq = NULL;
1340 }
1341 channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_RECEIVING);
1342 if (NULL != peer_ctx->recv_channel_ctx &&
1343 GNUNET_YES != Peers_check_channel_flag (channel_flag, Peers_CHANNEL_DESTROING))
1344 { 1382 {
1345 LOG (GNUNET_ERROR_TYPE_DEBUG, 1383 GNUNET_SCHEDULER_cancel (peer_ctx->destruction_task);
1346 "Destroying recv channel\n");
1347 GNUNET_CADET_channel_destroy (peer_ctx->recv_channel_ctx->channel);
1348 if (NULL != peer_ctx->recv_channel_ctx)
1349 {
1350 remove_channel_ctx (peer_ctx->recv_channel_ctx);
1351 }
1352 peer_ctx->recv_channel_ctx = NULL;
1353 } 1384 }
1354 1385
1355 GNUNET_free (peer_ctx->send_channel_flags); 1386 GNUNET_free (peer_ctx->send_channel_flags);
@@ -1363,6 +1394,15 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
1363 return GNUNET_YES; 1394 return GNUNET_YES;
1364} 1395}
1365 1396
1397static void
1398schedule_peer_ctx_destruction (struct PeerContext *peer_ctx)
1399{
1400 GNUNET_assert (NULL != peer_ctx);
1401 if (NULL == peer_ctx->destruction_task)
1402 {
1403 GNUNET_SCHEDULER_add_now (destroy_peer, peer_ctx);
1404 }
1405}
1366 1406
1367/** 1407/**
1368 * @brief set flags on a given peer. 1408 * @brief set flags on a given peer.
@@ -1708,10 +1748,7 @@ Peers_destroy_sending_channel (const struct GNUNET_PeerIdentity *peer)
1708 peer_ctx = get_peer_ctx (peer); 1748 peer_ctx = get_peer_ctx (peer);
1709 if (NULL != peer_ctx->send_channel_ctx) 1749 if (NULL != peer_ctx->send_channel_ctx)
1710 { 1750 {
1711 set_channel_flag (peer_ctx->send_channel_flags, Peers_CHANNEL_CLEAN); 1751 schedule_channel_destruction (peer_ctx->send_channel_ctx);
1712 GNUNET_CADET_channel_destroy (peer_ctx->send_channel_ctx->channel);
1713 peer_ctx->send_channel_ctx = NULL;
1714 peer_ctx->mq = NULL;
1715 (void) Peers_check_connected (peer); 1752 (void) Peers_check_connected (peer);
1716 return GNUNET_YES; 1753 return GNUNET_YES;
1717 } 1754 }
@@ -1723,23 +1760,19 @@ destroy_channel (void *cls)
1723{ 1760{
1724 struct ChannelCtx *channel_ctx = cls; 1761 struct ChannelCtx *channel_ctx = cls;
1725 struct PeerContext *peer_ctx = channel_ctx->peer_ctx; 1762 struct PeerContext *peer_ctx = channel_ctx->peer_ctx;
1726 uint32_t *channel_flag; 1763
1764 GNUNET_assert (channel_ctx == peer_ctx->send_channel_ctx ||
1765 channel_ctx == peer_ctx->recv_channel_ctx);
1727 1766
1728 channel_ctx->destruction_task = NULL; 1767 channel_ctx->destruction_task = NULL;
1729 GNUNET_CADET_channel_destroy (peer_ctx->send_channel_ctx->channel); 1768 GNUNET_CADET_channel_destroy (channel_ctx->channel);
1730 channel_flag = Peers_get_channel_flag (&peer_ctx->peer_id, Peers_CHANNEL_ROLE_SENDING);
1731 Peers_set_channel_flag (channel_flag, Peers_CHANNEL_DESTROING);
1732 remove_channel_ctx (peer_ctx->send_channel_ctx); 1769 remove_channel_ctx (peer_ctx->send_channel_ctx);
1733 peer_ctx->send_channel_ctx = NULL;
1734 if (channel_ctx == peer_ctx->send_channel_ctx)
1735 {
1736 peer_ctx->mq = NULL;
1737 }
1738} 1770}
1739 1771
1740static void 1772static void
1741schedule_channel_destruction (struct ChannelCtx *channel_ctx) 1773schedule_channel_destruction (struct ChannelCtx *channel_ctx)
1742{ 1774{
1775 GNUNET_assert (NULL != channel_ctx);
1743 if (NULL != channel_ctx->destruction_task) 1776 if (NULL != channel_ctx->destruction_task)
1744 { 1777 {
1745 channel_ctx->destruction_task = 1778 channel_ctx->destruction_task =
@@ -1747,6 +1780,7 @@ schedule_channel_destruction (struct ChannelCtx *channel_ctx)
1747 } 1780 }
1748} 1781}
1749 1782
1783
1750/** 1784/**
1751 * This is called when a channel is destroyed. 1785 * This is called when a channel is destroyed.
1752 * 1786 *
@@ -1772,61 +1806,30 @@ Peers_cleanup_destroyed_channel (void *cls,
1772 /* If our peer issued the destruction of the channel, the #Peers_TO_DESTROY 1806 /* If our peer issued the destruction of the channel, the #Peers_TO_DESTROY
1773 * flag will be set. In this case simply make sure that the channels are 1807 * flag will be set. In this case simply make sure that the channels are
1774 * cleaned. */ 1808 * cleaned. */
1775 /* FIXME This distinction seems to be redundant */ 1809 /* The distinction seems to be redundant */
1776 if (Peers_check_peer_flag (peer, Peers_TO_DESTROY)) 1810 LOG (GNUNET_ERROR_TYPE_DEBUG,
1777 {/* We initiatad the destruction of this particular peer */ 1811 "Peer is NOT in the process of being destroyed\n");
1812 if ( (NULL != peer_ctx->send_channel_ctx) &&
1813 (channel == peer_ctx->send_channel_ctx->channel) )
1814 { /* Something (but us) killd the channel - clean up peer */
1778 LOG (GNUNET_ERROR_TYPE_DEBUG, 1815 LOG (GNUNET_ERROR_TYPE_DEBUG,
1779 "Peer is in the process of being destroyed\n"); 1816 "send channel (%s) was destroyed - cleaning up\n",
1780 if (channel == channel_ctx->channel) 1817 GNUNET_i2s (peer));
1781 { 1818 remove_channel_ctx (peer_ctx->send_channel_ctx);
1782 peer_ctx->send_channel_ctx = NULL;
1783 peer_ctx->mq = NULL;
1784 }
1785 else if (channel == peer_ctx->recv_channel_ctx->channel)
1786 {
1787 peer_ctx->recv_channel_ctx = NULL;
1788 }
1789
1790 if (NULL != peer_ctx->send_channel_ctx)
1791 {
1792 schedule_channel_destruction (peer_ctx->send_channel_ctx);
1793 }
1794 if (NULL != peer_ctx->recv_channel_ctx)
1795 {
1796 schedule_channel_destruction (peer_ctx->recv_channel_ctx);
1797 }
1798 /* Set the #Peers_ONLINE flag accordingly */
1799 (void) Peers_check_connected (peer);
1800 return;
1801 } 1819 }
1802 1820 else if ( (NULL != peer_ctx->recv_channel_ctx) &&
1803 else 1821 (channel == peer_ctx->recv_channel_ctx->channel) )
1804 { /* We did not initiate the destruction of this peer */ 1822 { /* Other peer doesn't want to send us messages anymore */
1805 LOG (GNUNET_ERROR_TYPE_DEBUG, 1823 LOG (GNUNET_ERROR_TYPE_DEBUG,
1806 "Peer is NOT in the process of being destroyed\n"); 1824 "Peer %s destroyed recv channel - cleaning up channel\n",
1807 if ( (NULL != peer_ctx->send_channel_ctx) && 1825 GNUNET_i2s (peer));
1808 (channel == peer_ctx->send_channel_ctx->channel) ) 1826 remove_channel_ctx (peer_ctx->send_channel_ctx);
1809 { /* Something (but us) killd the channel - clean up peer */ 1827 }
1810 LOG (GNUNET_ERROR_TYPE_DEBUG, 1828 else
1811 "send channel (%s) was destroyed - cleaning up\n", 1829 {
1812 GNUNET_i2s (peer)); 1830 LOG (GNUNET_ERROR_TYPE_WARNING,
1813 peer_ctx->send_channel_ctx = NULL; 1831 "unknown channel (%s) was destroyed\n",
1814 peer_ctx->mq = NULL; 1832 GNUNET_i2s (peer));
1815 }
1816 else if ( (NULL != peer_ctx->recv_channel_ctx) &&
1817 (channel == peer_ctx->recv_channel_ctx->channel) )
1818 { /* Other peer doesn't want to send us messages anymore */
1819 LOG (GNUNET_ERROR_TYPE_DEBUG,
1820 "Peer %s destroyed recv channel - cleaning up channel\n",
1821 GNUNET_i2s (peer));
1822 peer_ctx->recv_channel_ctx = NULL;
1823 }
1824 else
1825 {
1826 LOG (GNUNET_ERROR_TYPE_WARNING,
1827 "unknown channel (%s) was destroyed\n",
1828 GNUNET_i2s (peer));
1829 }
1830 } 1833 }
1831 (void) Peers_check_connected (peer); 1834 (void) Peers_check_connected (peer);
1832} 1835}
@@ -2572,6 +2575,9 @@ send_pull_reply (const struct GNUNET_PeerIdentity *peer_id,
2572 2575
2573 Peers_send_message (peer_id, ev, "PULL REPLY"); 2576 Peers_send_message (peer_id, ev, "PULL REPLY");
2574 GNUNET_STATISTICS_update(stats, "# pull reply send issued", 1, GNUNET_NO); 2577 GNUNET_STATISTICS_update(stats, "# pull reply send issued", 1, GNUNET_NO);
2578 // TODO check with send intention: as send_channel is used/opened we indicate
2579 // a sending intention without intending it.
2580 // -> clean peer afterwards?
2575} 2581}
2576 2582
2577 2583
@@ -2704,7 +2710,7 @@ remove_peer (const struct GNUNET_PeerIdentity *peer)
2704 CustomPeerMap_remove_peer (push_map, peer); 2710 CustomPeerMap_remove_peer (push_map, peer);
2705 RPS_sampler_reinitialise_by_value (prot_sampler, peer); 2711 RPS_sampler_reinitialise_by_value (prot_sampler, peer);
2706 RPS_sampler_reinitialise_by_value (client_sampler, peer); 2712 RPS_sampler_reinitialise_by_value (client_sampler, peer);
2707 Peers_remove_peer (peer); 2713 schedule_peer_ctx_destruction (get_peer_ctx (peer));
2708} 2714}
2709 2715
2710 2716
@@ -2772,8 +2778,32 @@ add_channel_ctx (struct PeerContext *peer_ctx)
2772static void 2778static void
2773remove_channel_ctx (struct ChannelCtx *channel_ctx) 2779remove_channel_ctx (struct ChannelCtx *channel_ctx)
2774{ 2780{
2775 GNUNET_CONTAINER_DLL_remove (channel_ctx_head, channel_ctx_tail, channel_ctx); 2781 struct PeerContext *peer_ctx = channel_ctx->peer_ctx;
2782 if (NULL != channel_ctx->destruction_task)
2783 {
2784 GNUNET_SCHEDULER_cancel (channel_ctx->destruction_task);
2785 }
2776 GNUNET_free (channel_ctx); 2786 GNUNET_free (channel_ctx);
2787
2788 if (channel_ctx == peer_ctx->send_channel_ctx)
2789 {
2790 peer_ctx->send_channel_ctx = NULL;
2791 peer_ctx->mq = NULL;
2792 }
2793 else if (channel_ctx == peer_ctx->recv_channel_ctx)
2794 {
2795 peer_ctx->recv_channel_ctx = NULL;
2796 }
2797 else
2798 {
2799 LOG (GNUNET_ERROR_TYPE_ERROR,
2800 "Trying to remove channel_ctx that is not associated with a peer\n");
2801 LOG (GNUNET_ERROR_TYPE_ERROR,
2802 "\trecv: %p\n", peer_ctx->recv_channel_ctx);
2803 LOG (GNUNET_ERROR_TYPE_ERROR,
2804 "\tsend: %p\n", peer_ctx->send_channel_ctx);
2805 GNUNET_assert (0);
2806 }
2777} 2807}
2778 2808
2779/** 2809/**
@@ -2809,103 +2839,21 @@ cleanup_destroyed_channel (void *cls,
2809 } 2839 }
2810 2840
2811 peer_ctx = get_peer_ctx (peer); 2841 peer_ctx = get_peer_ctx (peer);
2812 if (GNUNET_YES == Peers_check_channel_role (peer, channel, Peers_CHANNEL_ROLE_RECEIVING))
2813 {
2814 LOG (GNUNET_ERROR_TYPE_DEBUG,
2815 "Callback on destruction of recv-channel was called (%s)\n",
2816 GNUNET_i2s (peer));
2817 set_channel_flag (peer_ctx->recv_channel_flags, Peers_CHANNEL_DESTROING);
2818 } else if (GNUNET_YES == Peers_check_channel_role (peer, channel, Peers_CHANNEL_ROLE_SENDING))
2819 {
2820 LOG (GNUNET_ERROR_TYPE_DEBUG,
2821 "Callback on destruction of send-channel was called (%s)\n",
2822 GNUNET_i2s (peer));
2823 set_channel_flag (peer_ctx->send_channel_flags, Peers_CHANNEL_DESTROING);
2824 } else {
2825 LOG (GNUNET_ERROR_TYPE_ERROR,
2826 "Channel to be destroyed has is neither sending nor receiving role\n");
2827 }
2828 2842
2829 if (GNUNET_YES == Peers_check_peer_flag (peer, Peers_TO_DESTROY)) 2843 // What should be done here:
2830 { /* We are in the middle of removing that peer from our knowledge. In this 2844 // * cleanup everything related to the channel
2831 case simply make sure that the channels are cleaned. */ 2845 // * memory
2832 Peers_cleanup_destroyed_channel (cls, channel); 2846 // * remove peer if necessary
2833 to_file (file_name_view_log,
2834 "-%s\t(cleanup channel, ourself)",
2835 GNUNET_i2s_full (peer));
2836 remove_channel_ctx (channel_ctx);
2837 if (peer_ctx->send_channel_ctx == channel_ctx)
2838 {
2839 peer_ctx->send_channel_ctx = NULL;
2840 }
2841 else if (peer_ctx->recv_channel_ctx == channel_ctx)
2842 {
2843 peer_ctx->recv_channel_ctx = NULL;
2844 }
2845 else
2846 {
2847 LOG (GNUNET_ERROR_TYPE_ERROR,
2848 "Trying to remove channel_ctx that is not associated with a peer\n");
2849 GNUNET_assert (0);
2850 }
2851 return;
2852 }
2853 2847
2854 if (GNUNET_YES == 2848 if (peer_ctx->recv_channel_ctx == channel_ctx)
2855 Peers_check_channel_role (peer, channel, Peers_CHANNEL_ROLE_SENDING)) 2849 {
2856 { /* Channel used for sending was destroyed */ 2850 remove_channel_ctx (channel_ctx);
2857 /* Possible causes of channel destruction:
2858 * - ourselves -> cleaning send channel -> clean context
2859 * - other peer -> peer probably went down -> remove
2860 */
2861 channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_SENDING);
2862 if (GNUNET_YES == Peers_check_channel_flag (channel_flag, Peers_CHANNEL_CLEAN))
2863 { /* We are about to clean the sending channel. Clean the respective
2864 * context */
2865 Peers_cleanup_destroyed_channel (cls, channel);
2866 remove_channel_ctx (channel_ctx);
2867 return;
2868 }
2869 else
2870 { /* Other peer destroyed our sending channel that it is supposed to keep
2871 * open. It probably went down. Remove it from our knowledge. */
2872 Peers_cleanup_destroyed_channel (cls, channel);
2873 remove_peer (peer);
2874 remove_channel_ctx (channel_ctx);
2875 return;
2876 }
2877 }
2878 else if (GNUNET_YES ==
2879 Peers_check_channel_role (peer, channel, Peers_CHANNEL_ROLE_RECEIVING))
2880 { /* Channel used for receiving was destroyed */
2881 /* Possible causes of channel destruction:
2882 * - ourselves -> peer tried to establish channel twice -> clean context
2883 * - other peer -> peer doesn't want to send us data -> clean
2884 */
2885 channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_RECEIVING);
2886 if (GNUNET_YES ==
2887 Peers_check_channel_flag (channel_flag, Peers_CHANNEL_ESTABLISHED_TWICE))
2888 { /* Other peer tried to establish a channel to us twice. We do not accept
2889 * that. Clean the context. */
2890 Peers_cleanup_destroyed_channel (cls, channel);
2891 remove_channel_ctx (channel_ctx);
2892 return;
2893 }
2894 else
2895 { /* Other peer doesn't want to send us data anymore. We are free to clean
2896 * it. */
2897 Peers_cleanup_destroyed_channel (cls, channel);
2898 clean_peer (peer);
2899 remove_channel_ctx (channel_ctx);
2900 return;
2901 }
2902 } 2851 }
2903 else 2852 else if (peer_ctx->send_channel_ctx == channel_ctx)
2904 { 2853 {
2905 LOG (GNUNET_ERROR_TYPE_WARNING, 2854 remove_channel_ctx (channel_ctx);
2906 "Destroyed channel is neither sending nor receiving channel\n"); 2855 remove_peer (&peer_ctx->peer_id);
2907 } 2856 }
2908 remove_channel_ctx (channel_ctx);
2909} 2857}
2910 2858
2911/*********************************************************************** 2859/***********************************************************************
@@ -3164,8 +3112,6 @@ handle_client_seed (void *cls,
3164 3112
3165 num_peers = ntohl (msg->num_peers); 3113 num_peers = ntohl (msg->num_peers);
3166 peers = (struct GNUNET_PeerIdentity *) &msg[1]; 3114 peers = (struct GNUNET_PeerIdentity *) &msg[1];
3167 //peers = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity);
3168 //GNUNET_memcpy (peers, &msg[1], num_peers * sizeof (struct GNUNET_PeerIdentity));
3169 3115
3170 LOG (GNUNET_ERROR_TYPE_DEBUG, 3116 LOG (GNUNET_ERROR_TYPE_DEBUG,
3171 "Client seeded peers:\n"); 3117 "Client seeded peers:\n");
@@ -3180,9 +3126,6 @@ handle_client_seed (void *cls,
3180 3126
3181 got_peer (&peers[i]); 3127 got_peer (&peers[i]);
3182 } 3128 }
3183
3184 ////GNUNET_free (peers);
3185
3186 GNUNET_SERVICE_client_continue (cli_ctx->client); 3129 GNUNET_SERVICE_client_continue (cli_ctx->client);
3187} 3130}
3188 3131
@@ -4078,7 +4021,6 @@ do_round (void *cls)
4078 "-%s", 4021 "-%s",
4079 GNUNET_i2s_full (&peers_to_clean[i])); 4022 GNUNET_i2s_full (&peers_to_clean[i]));
4080 clean_peer (&peers_to_clean[i]); 4023 clean_peer (&peers_to_clean[i]);
4081 //peer_destroy_channel_send (sender);
4082 } 4024 }
4083 4025
4084 GNUNET_array_grow (peers_to_clean, peers_to_clean_size, 0); 4026 GNUNET_array_grow (peers_to_clean, peers_to_clean_size, 0);
@@ -4134,7 +4076,6 @@ do_round (void *cls)
4134 GNUNET_i2s (update_peer)); 4076 GNUNET_i2s (update_peer));
4135 insert_in_sampler (NULL, update_peer); 4077 insert_in_sampler (NULL, update_peer);
4136 clean_peer (update_peer); /* This cleans only if it is not in the view */ 4078 clean_peer (update_peer); /* This cleans only if it is not in the view */
4137 //peer_destroy_channel_send (sender);
4138 } 4079 }
4139 4080
4140 for (i = 0; i < CustomPeerMap_size (pull_map); i++) 4081 for (i = 0; i < CustomPeerMap_size (pull_map); i++)
@@ -4145,7 +4086,6 @@ do_round (void *cls)
4145 insert_in_sampler (NULL, CustomPeerMap_get_peer_by_index (pull_map, i)); 4086 insert_in_sampler (NULL, CustomPeerMap_get_peer_by_index (pull_map, i));
4146 /* This cleans only if it is not in the view */ 4087 /* This cleans only if it is not in the view */
4147 clean_peer (CustomPeerMap_get_peer_by_index (pull_map, i)); 4088 clean_peer (CustomPeerMap_get_peer_by_index (pull_map, i));
4148 //peer_destroy_channel_send (sender);
4149 } 4089 }
4150 4090
4151 4091
@@ -4247,7 +4187,6 @@ shutdown_task (void *cls)
4247{ 4187{
4248 struct ClientContext *client_ctx; 4188 struct ClientContext *client_ctx;
4249 struct ReplyCls *reply_cls; 4189 struct ReplyCls *reply_cls;
4250 struct ChannelCtx *channel_ctx;
4251 4190
4252 LOG (GNUNET_ERROR_TYPE_DEBUG, 4191 LOG (GNUNET_ERROR_TYPE_DEBUG,
4253 "RPS is going down\n"); 4192 "RPS is going down\n");
@@ -4271,11 +4210,6 @@ shutdown_task (void *cls)
4271 GNUNET_CONTAINER_DLL_remove (cli_ctx_head, cli_ctx_tail, client_ctx); 4210 GNUNET_CONTAINER_DLL_remove (cli_ctx_head, cli_ctx_tail, client_ctx);
4272 GNUNET_free (client_ctx); 4211 GNUNET_free (client_ctx);
4273 } 4212 }
4274 /* Clean all leftover channel contexts */
4275 while (NULL != (channel_ctx = channel_ctx_head))
4276 {
4277 remove_channel_ctx (channel_ctx);
4278 }
4279 GNUNET_PEERINFO_notify_cancel (peerinfo_notify_handle); 4213 GNUNET_PEERINFO_notify_cancel (peerinfo_notify_handle);
4280 GNUNET_PEERINFO_disconnect (peerinfo_handle); 4214 GNUNET_PEERINFO_disconnect (peerinfo_handle);
4281 4215