aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-06-20 13:48:10 +0000
committerJulius Bünger <buenger@mytum.de>2015-06-20 13:48:10 +0000
commitb69026bf6eadb70ab0a88a4f092b3a37db23e4c4 (patch)
treec2e1be9791889326a5b2e30537dc0fb837d11201 /src
parente3454e70e4c78c11f395fbc485b810304feba801 (diff)
downloadgnunet-b69026bf6eadb70ab0a88a4f092b3a37db23e4c4.tar.gz
gnunet-b69026bf6eadb70ab0a88a4f092b3a37db23e4c4.zip
-removed unnecessary data structure (pending pull list)
Diffstat (limited to 'src')
-rw-r--r--src/rps/gnunet-service-rps.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index b8d865b57..b4dc152cc 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -361,17 +361,6 @@ static struct GNUNET_TIME_Relative request_rate;
361 361
362 362
363/** 363/**
364 * List with the peers we sent requests to.
365 */
366struct GNUNET_PeerIdentity *pending_pull_reply_list;
367
368/**
369 * Size of #pending_pull_reply_list.
370 */
371uint32_t pending_pull_reply_list_size;
372
373
374/**
375 * Number of history update tasks. 364 * Number of history update tasks.
376 */ 365 */
377uint32_t num_hist_update_tasks; 366uint32_t num_hist_update_tasks;
@@ -1676,7 +1665,7 @@ handle_peer_pull_reply (void *cls,
1676 // FIXME wait for cadet to change this function 1665 // FIXME wait for cadet to change this function
1677 sender_ctx = get_peer_ctx (peer_map, sender); 1666 sender_ctx = get_peer_ctx (peer_map, sender);
1678 1667
1679 if (GNUNET_YES == get_peer_flag (sender_ctx, PULL_REPLY_PENDING)) 1668 if (GNUNET_YES != get_peer_flag (sender_ctx, PULL_REPLY_PENDING))
1680 { 1669 {
1681 GNUNET_break_op (0); 1670 GNUNET_break_op (0);
1682 return GNUNET_OK; 1671 return GNUNET_OK;
@@ -1748,7 +1737,6 @@ handle_peer_pull_reply (void *cls,
1748 } 1737 }
1749 1738
1750 unset_peer_flag (sender_ctx, PULL_REPLY_PENDING); 1739 unset_peer_flag (sender_ctx, PULL_REPLY_PENDING);
1751 rem_from_list (&pending_pull_reply_list, &pending_pull_reply_list_size, sender);
1752 1740
1753 return GNUNET_OK; 1741 return GNUNET_OK;
1754} 1742}
@@ -1810,13 +1798,16 @@ send_pull_request (struct GNUNET_PeerIdentity *peer_id)
1810{ 1798{
1811 struct GNUNET_MQ_Envelope *ev; 1799 struct GNUNET_MQ_Envelope *ev;
1812 struct GNUNET_MQ_Handle *mq; 1800 struct GNUNET_MQ_Handle *mq;
1801 struct PeerContext *peer_ctx;
1802
1803 peer_ctx = get_peer_ctx (peer_map, peer_id);
1804 GNUNET_assert (GNUNET_NO == get_peer_flag (peer_ctx, PULL_REPLY_PENDING));
1805 set_peer_flag (peer_ctx, PULL_REPLY_PENDING);
1813 1806
1814 LOG (GNUNET_ERROR_TYPE_DEBUG, 1807 LOG (GNUNET_ERROR_TYPE_DEBUG,
1815 "Sending PULL request to peer %s of gossiped list.\n", 1808 "Sending PULL request to peer %s of gossiped list.\n",
1816 GNUNET_i2s (peer_id)); 1809 GNUNET_i2s (peer_id));
1817 1810
1818 GNUNET_array_append (pending_pull_reply_list, pending_pull_reply_list_size, *peer_id);
1819
1820 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST); 1811 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST);
1821 mq = get_mq (peer_map, peer_id); 1812 mq = get_mq (peer_map, peer_id);
1822 GNUNET_MQ_send (mq, ev); 1813 GNUNET_MQ_send (mq, ev);
@@ -2143,10 +2134,9 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2143 for (i = a_peers; i < b_peers; i++) 2134 for (i = a_peers; i < b_peers; i++)
2144 { 2135 {
2145 peer = view_array[permut[i]]; 2136 peer = view_array[permut[i]];
2137 peer_ctx = get_peer_ctx (peer_map, &peer);
2146 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, &peer) && 2138 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, &peer) &&
2147 GNUNET_YES != in_arr (pending_pull_reply_list, 2139 GNUNET_NO == get_peer_flag (peer_ctx, PULL_REPLY_PENDING)) // TODO
2148 pending_pull_reply_list_size,
2149 &peer)) // TODO
2150 { // FIXME if this fails schedule/loop this for later 2140 { // FIXME if this fails schedule/loop this for later
2151 send_pull_request (&peer); 2141 send_pull_request (&peer);
2152 } 2142 }
@@ -2416,9 +2406,7 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
2416 peer_ctx->is_live_task = NULL; 2406 peer_ctx->is_live_task = NULL;
2417 } 2407 }
2418 2408
2419 rem_from_list (&pending_pull_reply_list, 2409 unset_peer_flag (peer_ctx, PULL_REPLY_PENDING);
2420 &pending_pull_reply_list_size,
2421 key);
2422 2410
2423 to_file (file_name_view_log, 2411 to_file (file_name_view_log,
2424 "-%s\t(cleanup channel, other peer)", 2412 "-%s\t(cleanup channel, other peer)",
@@ -2818,8 +2806,6 @@ run (void *cls,
2818 push_list_size = 0; 2806 push_list_size = 0;
2819 pull_list = NULL; 2807 pull_list = NULL;
2820 pull_list_size = 0; 2808 pull_list_size = 0;
2821 pending_pull_reply_list = NULL;
2822 pending_pull_reply_list_size = 0;
2823 2809
2824 2810
2825 num_hist_update_tasks = 0; 2811 num_hist_update_tasks = 0;