aboutsummaryrefslogtreecommitdiff
path: root/src/rps
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-07-29 11:28:16 +0000
committerJulius Bünger <buenger@mytum.de>2015-07-29 11:28:16 +0000
commita31913c347bc5b67cc0388d430375d0606a7505b (patch)
treebb444bafdf381efd51c5fe53d8ce9c96e2238a2d /src/rps
parent01a62e8e969eb749a850e6425e32cd7ef269ee9e (diff)
downloadgnunet-a31913c347bc5b67cc0388d430375d0606a7505b.tar.gz
gnunet-a31913c347bc5b67cc0388d430375d0606a7505b.zip
-stop passing static peermap
Diffstat (limited to 'src/rps')
-rw-r--r--src/rps/gnunet-service-rps.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 71903709a..9be4036f8 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -52,8 +52,6 @@
52 52
53// TODO API request_cancel 53// TODO API request_cancel
54 54
55// TODO don't pass peermap all the time
56
57// hist_size_init, hist_size_max 55// hist_size_init, hist_size_max
58 56
59/** 57/**
@@ -796,8 +794,7 @@ cadet_ntfy_tmt_rdy_cb (void *cls, size_t size, void *buf)
796 * Get the channel of a peer. If not existing, create. 794 * Get the channel of a peer. If not existing, create.
797 */ 795 */
798 struct GNUNET_CADET_Channel * 796 struct GNUNET_CADET_Channel *
799get_channel (struct GNUNET_CONTAINER_MultiPeerMap *peer_map, 797get_channel (const struct GNUNET_PeerIdentity *peer)
800 const struct GNUNET_PeerIdentity *peer)
801{ 798{
802 struct PeerContext *peer_ctx; 799 struct PeerContext *peer_ctx;
803 800
@@ -827,8 +824,7 @@ get_channel (struct GNUNET_CONTAINER_MultiPeerMap *peer_map,
827 * simply return it, otherways create one. 824 * simply return it, otherways create one.
828 */ 825 */
829 struct GNUNET_MQ_Handle * 826 struct GNUNET_MQ_Handle *
830get_mq (struct GNUNET_CONTAINER_MultiPeerMap *peer_map, 827get_mq (const struct GNUNET_PeerIdentity *peer_id)
831 const struct GNUNET_PeerIdentity *peer_id)
832{ 828{
833 struct PeerContext *peer_ctx; 829 struct PeerContext *peer_ctx;
834 830
@@ -838,7 +834,7 @@ get_mq (struct GNUNET_CONTAINER_MultiPeerMap *peer_map,
838 834
839 if (NULL == peer_ctx->mq) 835 if (NULL == peer_ctx->mq)
840 { 836 {
841 (void) get_channel (peer_map, peer_id); 837 (void) get_channel (peer_id);
842 peer_ctx->mq = GNUNET_CADET_mq_create (peer_ctx->send_channel); 838 peer_ctx->mq = GNUNET_CADET_mq_create (peer_ctx->send_channel);
843 //do I have to explicitly put it in the peer_map? 839 //do I have to explicitly put it in the peer_map?
844 (void) GNUNET_CONTAINER_multipeermap_put (peer_map, peer_id, peer_ctx, 840 (void) GNUNET_CONTAINER_multipeermap_put (peer_map, peer_id, peer_ctx,
@@ -863,7 +859,7 @@ check_peer_live (struct PeerContext *peer_ctx)
863 if (NULL == peer_ctx->transmit_handle && 859 if (NULL == peer_ctx->transmit_handle &&
864 NULL == peer_ctx->send_channel) 860 NULL == peer_ctx->send_channel)
865 { 861 {
866 (void) get_channel (peer_map, &peer_ctx->peer_id); 862 (void) get_channel (&peer_ctx->peer_id);
867 peer_ctx->transmit_handle = 863 peer_ctx->transmit_handle =
868 GNUNET_CADET_notify_transmit_ready (peer_ctx->send_channel, 864 GNUNET_CADET_notify_transmit_ready (peer_ctx->send_channel,
869 GNUNET_NO, 865 GNUNET_NO,
@@ -960,7 +956,7 @@ insert_in_view (void *cls, const struct GNUNET_PeerIdentity *peer)
960 view_array = NULL; 956 view_array = NULL;
961 } 957 }
962 958
963 (void) get_channel (peer_map, peer); 959 (void) get_channel (peer);
964} 960}
965 961
966/** 962/**
@@ -1161,7 +1157,7 @@ send_pull_reply (const struct GNUNET_PeerIdentity *peer_id,
1161 "PULL REQUEST from peer %s received, going to send %u peers\n", 1157 "PULL REQUEST from peer %s received, going to send %u peers\n",
1162 GNUNET_i2s (peer_id), send_size); 1158 GNUNET_i2s (peer_id), send_size);
1163 1159
1164 mq = get_mq (peer_map, peer_id); 1160 mq = get_mq (peer_id);
1165 1161
1166 ev = GNUNET_MQ_msg_extra (out_msg, 1162 ev = GNUNET_MQ_msg_extra (out_msg,
1167 send_size * sizeof (struct GNUNET_PeerIdentity), 1163 send_size * sizeof (struct GNUNET_PeerIdentity),
@@ -1820,7 +1816,7 @@ send_pull_request (struct GNUNET_PeerIdentity *peer_id)
1820 GNUNET_i2s (peer_id)); 1816 GNUNET_i2s (peer_id));
1821 1817
1822 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST); 1818 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST);
1823 mq = get_mq (peer_map, peer_id); 1819 mq = get_mq (peer_id);
1824 GNUNET_MQ_send (mq, ev); 1820 GNUNET_MQ_send (mq, ev);
1825} 1821}
1826 1822
@@ -1841,7 +1837,7 @@ send_push (struct GNUNET_PeerIdentity *peer_id)
1841 GNUNET_i2s (peer_id)); 1837 GNUNET_i2s (peer_id));
1842 1838
1843 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PUSH); 1839 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PUSH);
1844 mq = get_mq (peer_map, peer_id); 1840 mq = get_mq (peer_id);
1845 GNUNET_MQ_send (mq, ev); 1841 GNUNET_MQ_send (mq, ev);
1846} 1842}
1847 1843