X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Frps%2Fgnunet-service-rps.c;h=fd398b863c02fd60f1c8c18ad18850a1387a92eb;hb=200fd67bcca55ad08351719b154516d91443a298;hp=d60029f3be121b55ed220cbf7b6f38e878c54414;hpb=15a1f81b91b94b2272b3dcf841f630e170676c46;p=oweals%2Fgnunet.git diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index d60029f3b..fd398b863 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -52,6 +52,8 @@ // TODO API request_cancel +// TODO don't pass peermap all the time + // hist_size_init, hist_size_max /** @@ -812,12 +814,6 @@ get_channel (struct GNUNET_CONTAINER_MultiPeerMap *peer_map, GNUNET_RPS_CADET_PORT, GNUNET_CADET_OPTION_RELIABLE); - // do I have to explicitly put it in the peer_map? - (void) GNUNET_CONTAINER_multipeermap_put - (peer_map, - peer, - peer_ctx, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); } return peer_ctx->send_channel; } @@ -859,12 +855,14 @@ get_mq (struct GNUNET_CONTAINER_MultiPeerMap *peer_map, void check_peer_live (struct PeerContext *peer_ctx) { - (void) get_channel (peer_map, &peer_ctx->peer_id); LOG (GNUNET_ERROR_TYPE_DEBUG, "Get informed about peer %s getting live\n", GNUNET_i2s (&peer_ctx->peer_id)); - if (NULL == peer_ctx->is_live_task) + + if (NULL == peer_ctx->is_live_task && + NULL == peer_ctx->send_channel) { + (void) get_channel (peer_map, &peer_ctx->peer_id); peer_ctx->is_live_task = GNUNET_CADET_notify_transmit_ready (peer_ctx->send_channel, GNUNET_NO, @@ -872,16 +870,13 @@ check_peer_live (struct PeerContext *peer_ctx) sizeof (struct GNUNET_MessageHeader), cadet_ntfy_tmt_rdy_cb, peer_ctx); - (void) GNUNET_CONTAINER_multipeermap_put (peer_map, - &peer_ctx->peer_id, - peer_ctx, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); } - else - { + else if (NULL != peer_ctx->is_live_task) LOG (GNUNET_ERROR_TYPE_DEBUG, "Already waiting for notification\n"); - } + else if (NULL != peer_ctx->send_channel) + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Already have established channel to peer\n"); } @@ -1564,7 +1559,7 @@ generate_view_array (unsigned int view_size) * Reply with the view of PeerIDs. * * @param cls Closure - * @param channel The channel the PUSH was received over + * @param channel The channel the PULL REQUEST was received over * @param channel_ctx The context associated with this channel * @param msg The message header */ @@ -1850,8 +1845,7 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); * Turn RPS service to act malicious. * * @param cls Closure - * @param channel The channel the PUSH was received over - * @param channel_ctx The context associated with this channel + * @param client The client that sent the message * @param msg The message header */ static void