aboutsummaryrefslogtreecommitdiff
path: root/src/rps/rps_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/rps_api.c')
-rw-r--r--src/rps/rps_api.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c
index 854ea25cf..42cec9761 100644
--- a/src/rps/rps_api.c
+++ b/src/rps/rps_api.c
@@ -339,7 +339,8 @@ GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h,
339GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h, 339GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
340 uint32_t type, 340 uint32_t type,
341 uint32_t num_peers, 341 uint32_t num_peers,
342 const struct GNUNET_PeerIdentity *peer_ids) 342 const struct GNUNET_PeerIdentity *peer_ids,
343 const struct GNUNET_PeerIdentity *target_peer)
343{ 344{
344 size_t size_needed; 345 size_t size_needed;
345 uint32_t num_peers_max; 346 uint32_t num_peers_max;
@@ -379,8 +380,8 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
379 GNUNET_MESSAGE_TYPE_RPS_ACT_MALICIOUS); 380 GNUNET_MESSAGE_TYPE_RPS_ACT_MALICIOUS);
380 msg->type = htonl (type); 381 msg->type = htonl (type);
381 msg->num_peers = htonl (num_peers_max); 382 msg->num_peers = htonl (num_peers_max);
382 if (2 == type 383 if ( (2 == type) ||
383 || 3 == type) 384 (3 == type) )
384 msg->attacked_peer = peer_ids[num_peers]; 385 msg->attacked_peer = peer_ids[num_peers];
385 memcpy (&msg[1], 386 memcpy (&msg[1],
386 tmp_peer_pointer, 387 tmp_peer_pointer,
@@ -400,9 +401,9 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
400 GNUNET_MESSAGE_TYPE_RPS_ACT_MALICIOUS); 401 GNUNET_MESSAGE_TYPE_RPS_ACT_MALICIOUS);
401 msg->type = htonl (type); 402 msg->type = htonl (type);
402 msg->num_peers = htonl (num_peers); 403 msg->num_peers = htonl (num_peers);
403 if (2 == type 404 if ( (2 == type) ||
404 || 3 == type) 405 (3 == type) )
405 msg->attacked_peer = peer_ids[num_peers]; 406 msg->attacked_peer = *target_peer;
406 memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity)); 407 memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity));
407 408
408 GNUNET_MQ_send (h->mq, ev); 409 GNUNET_MQ_send (h->mq, ev);
@@ -418,7 +419,17 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
418 void 419 void
419GNUNET_RPS_request_cancel (struct GNUNET_RPS_Request_Handle *rh) 420GNUNET_RPS_request_cancel (struct GNUNET_RPS_Request_Handle *rh)
420{ 421{
421 // TODO 422 struct GNUNET_MQ_Envelope *ev;
423 struct GNUNET_RPS_CS_RequestCancelMessage*msg;
424
425 LOG (GNUNET_ERROR_TYPE_DEBUG,
426 "Cancelling request with id %" PRIu32 "\n",
427 rh->id);
428
429 GNUNET_array_append (req_handlers, req_handlers_size, *rh);
430 ev = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RPS_CS_REQUEST_CANCEL);
431 msg->id = htonl (rh->id);
432 GNUNET_MQ_send (rh->rps_handle->mq, ev);
422} 433}
423 434
424 435