aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rps/rps_api.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c
index 2784fcdab..4879fd6e9 100644
--- a/src/rps/rps_api.c
+++ b/src/rps/rps_api.c
@@ -28,6 +28,10 @@
28#include "rps.h" 28#include "rps.h"
29#include "gnunet_rps_service.h" 29#include "gnunet_rps_service.h"
30 30
31#include <inttypes.h>
32
33#define LOG(kind,...) GNUNET_log_from (kind, "rps-api",__VA_ARGS__)
34
31/** 35/**
32 * Handler to handle requests from a client. 36 * Handler to handle requests from a client.
33 */ 37 */
@@ -231,8 +235,8 @@ GNUNET_RPS_request_peers (struct GNUNET_RPS_Handle *h, uint32_t n,
231 * @param ids the ids of the peers seeded 235 * @param ids the ids of the peers seeded
232 */ 236 */
233 void 237 void
234GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h, uint64_t n, 238GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h, uint32_t n,
235 const struct GNUNET_PeerIdentity * ids) 239 const struct GNUNET_PeerIdentity *ids)
236{ 240{
237 uint32_t size_needed; 241 uint32_t size_needed;
238 uint32_t num_peers_max; 242 uint32_t num_peers_max;
@@ -240,6 +244,17 @@ GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h, uint64_t n,
240 struct GNUNET_MQ_Envelope *ev; 244 struct GNUNET_MQ_Envelope *ev;
241 struct GNUNET_RPS_CS_SeedMessage *msg; 245 struct GNUNET_RPS_CS_SeedMessage *msg;
242 246
247 unsigned int i;
248
249 LOG (GNUNET_ERROR_TYPE_DEBUG,
250 "Client wants to seed %" PRIX32 " peers:\n",
251 n);
252 for (i = 0 ; i < n ; i++)
253 LOG (GNUNET_ERROR_TYPE_DEBUG,
254 "%u. peer: %s\n",
255 i,
256 GNUNET_i2s (&ids[i]));
257
243 /* The actual size the message occupies */ 258 /* The actual size the message occupies */
244 size_needed = sizeof (struct GNUNET_RPS_CS_SeedMessage) + 259 size_needed = sizeof (struct GNUNET_RPS_CS_SeedMessage) +
245 n * sizeof (struct GNUNET_PeerIdentity); 260 n * sizeof (struct GNUNET_PeerIdentity);
@@ -267,8 +282,9 @@ GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h, uint64_t n,
267 282
268 ev = GNUNET_MQ_msg_extra (msg, n * sizeof (struct GNUNET_PeerIdentity), 283 ev = GNUNET_MQ_msg_extra (msg, n * sizeof (struct GNUNET_PeerIdentity),
269 GNUNET_MESSAGE_TYPE_RPS_CS_SEED); 284 GNUNET_MESSAGE_TYPE_RPS_CS_SEED);
270 msg->num_peers = GNUNET_htonll (n); 285 msg->num_peers = htonl (n);
271 memcpy (&msg[1], tmp_peer_pointer, n * sizeof (struct GNUNET_PeerIdentity)); 286 memcpy (&msg[1], tmp_peer_pointer, n * sizeof (struct GNUNET_PeerIdentity));
287
272 GNUNET_MQ_send (h->mq, ev); 288 GNUNET_MQ_send (h->mq, ev);
273} 289}
274 290