// TODO API request_cancel
+// TODO don't pass peermap all the time
+
// hist_size_init, hist_size_max
/**
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;
}
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,
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");
}
* 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
*/
&peers[i]))
{
peer_ctx = get_peer_ctx (peer_map, &peers[i]);
- if (GNUNET_YES == get_peer_flag (peer_ctx, VALID) ||
- NULL != peer_ctx->send_channel ||
- NULL != peer_ctx->recv_channel)
+ if (GNUNET_YES == get_peer_flag (peer_ctx, VALID))
{
if (GNUNET_NO == in_arr (pull_list, pull_list_size, &peers[i]))
GNUNET_array_append (pull_list, pull_list_size, peers[i]);
* 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
/* Send PUSH to attacked peers */
peer_ctx = get_peer_ctx (peer_map, &attacked_peer);
- if (GNUNET_YES == get_peer_flag (peer_ctx, VALID)
- || NULL != peer_ctx->send_channel
- || NULL != peer_ctx->recv_channel)
+ if (GNUNET_YES == get_peer_flag (peer_ctx, VALID))
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Goding to send push to attacked peer (%s)\n",
"ROUNDINTERVAL",
&round_interval))
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to read ROUNDINTERVAL from config\n");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "RPS", "ROUNDINTERVAL");
GNUNET_SCHEDULER_shutdown ();
return;
}
/* Get initial size of sampler/view from the configuration */
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "RPS",
- "INITSIZE",
- (long long unsigned int *) &sampler_size_est_need))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, "RPS", "INITSIZE",
+ (long long unsigned int *) &sampler_size_est_need))
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to read INITSIZE from config\n");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "RPS", "INITSIZE");
GNUNET_SCHEDULER_shutdown ();
return;
}