diff options
Diffstat (limited to 'src/experimentation/gnunet-daemon-experimentation_nodes.c')
-rw-r--r-- | src/experimentation/gnunet-daemon-experimentation_nodes.c | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/src/experimentation/gnunet-daemon-experimentation_nodes.c b/src/experimentation/gnunet-daemon-experimentation_nodes.c index 5e29f5f73..f78569146 100644 --- a/src/experimentation/gnunet-daemon-experimentation_nodes.c +++ b/src/experimentation/gnunet-daemon-experimentation_nodes.c | |||
@@ -64,10 +64,10 @@ struct NodeComCtx | |||
64 | { | 64 | { |
65 | struct NodeComCtx *prev; | 65 | struct NodeComCtx *prev; |
66 | struct NodeComCtx *next; | 66 | struct NodeComCtx *next; |
67 | 67 | ||
68 | struct Node *n; | 68 | struct Node *n; |
69 | struct Experiment *e; | 69 | struct Experiment *e; |
70 | 70 | ||
71 | size_t size; | 71 | size_t size; |
72 | GNUNET_CONNECTION_TransmitReadyNotify notify; | 72 | GNUNET_CONNECTION_TransmitReadyNotify notify; |
73 | void *notify_cls; | 73 | void *notify_cls; |
@@ -79,7 +79,7 @@ struct NodeComCtx | |||
79 | * | 79 | * |
80 | * @param m peermap to update values from | 80 | * @param m peermap to update values from |
81 | */ | 81 | */ |
82 | static void | 82 | static void |
83 | update_stats (struct GNUNET_CONTAINER_MultiPeerMap *m) | 83 | update_stats (struct GNUNET_CONTAINER_MultiPeerMap *m) |
84 | { | 84 | { |
85 | GNUNET_assert (NULL != m); | 85 | GNUNET_assert (NULL != m); |
@@ -122,14 +122,14 @@ cleanup_node (void *cls, | |||
122 | struct NodeComCtx *e_cur; | 122 | struct NodeComCtx *e_cur; |
123 | struct NodeComCtx *e_next; | 123 | struct NodeComCtx *e_next; |
124 | struct GNUNET_CONTAINER_MultiPeerMap *cur = cls; | 124 | struct GNUNET_CONTAINER_MultiPeerMap *cur = cls; |
125 | 125 | ||
126 | n = value; | 126 | n = value; |
127 | if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task) | 127 | if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task) |
128 | { | 128 | { |
129 | GNUNET_SCHEDULER_cancel (n->timeout_task); | 129 | GNUNET_SCHEDULER_cancel (n->timeout_task); |
130 | n->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 130 | n->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
131 | } | 131 | } |
132 | 132 | ||
133 | if (NULL != n->cth) | 133 | if (NULL != n->cth) |
134 | { | 134 | { |
135 | GNUNET_CORE_notify_transmit_ready_cancel (n->cth); | 135 | GNUNET_CORE_notify_transmit_ready_cancel (n->cth); |
@@ -154,7 +154,7 @@ cleanup_node (void *cls, | |||
154 | * @param id the id to check | 154 | * @param id the id to check |
155 | * @return GNUNET_YES or GNUNET_NO | 155 | * @return GNUNET_YES or GNUNET_NO |
156 | */ | 156 | */ |
157 | static int | 157 | static int |
158 | is_me (const struct GNUNET_PeerIdentity *id) | 158 | is_me (const struct GNUNET_PeerIdentity *id) |
159 | { | 159 | { |
160 | if (0 == memcmp (&me, id, sizeof (me))) | 160 | if (0 == memcmp (&me, id, sizeof (me))) |
@@ -187,14 +187,14 @@ transmit_read_wrapper (void *cls, size_t bufsize, void *buf) | |||
187 | { | 187 | { |
188 | struct NodeComCtx *e_ctx = cls; | 188 | struct NodeComCtx *e_ctx = cls; |
189 | struct NodeComCtx *next; | 189 | struct NodeComCtx *next; |
190 | 190 | ||
191 | size_t res = e_ctx->notify (e_ctx->notify_cls, bufsize, buf); | 191 | size_t res = e_ctx->notify (e_ctx->notify_cls, bufsize, buf); |
192 | e_ctx->n->cth = NULL; | 192 | e_ctx->n->cth = NULL; |
193 | 193 | ||
194 | GNUNET_CONTAINER_DLL_remove (e_ctx->n->e_req_head, e_ctx->n->e_req_tail, e_ctx); | 194 | GNUNET_CONTAINER_DLL_remove (e_ctx->n->e_req_head, e_ctx->n->e_req_tail, e_ctx); |
195 | next = e_ctx->n->e_req_head; | 195 | next = e_ctx->n->e_req_head; |
196 | GNUNET_free (e_ctx); | 196 | GNUNET_free (e_ctx); |
197 | 197 | ||
198 | if (NULL != next) | 198 | if (NULL != next) |
199 | { | 199 | { |
200 | /* Schedule next message */ | 200 | /* Schedule next message */ |
@@ -209,9 +209,9 @@ schedule_transmisson (struct NodeComCtx *e_ctx) | |||
209 | { | 209 | { |
210 | if (NULL != e_ctx->n->cth) | 210 | if (NULL != e_ctx->n->cth) |
211 | return; | 211 | return; |
212 | 212 | ||
213 | e_ctx->n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0, FAST_TIMEOUT, | 213 | e_ctx->n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0, FAST_TIMEOUT, |
214 | &e_ctx->n->id, e_ctx->size, | 214 | &e_ctx->n->id, e_ctx->size, |
215 | transmit_read_wrapper, e_ctx); | 215 | transmit_read_wrapper, e_ctx); |
216 | if (NULL == e_ctx->n->cth) | 216 | if (NULL == e_ctx->n->cth) |
217 | { | 217 | { |
@@ -219,7 +219,7 @@ schedule_transmisson (struct NodeComCtx *e_ctx) | |||
219 | _("Cannot send message to peer `%s' for experiment `%s'\n"), | 219 | _("Cannot send message to peer `%s' for experiment `%s'\n"), |
220 | GNUNET_i2s(&e_ctx->n->id), e_ctx->e->name); | 220 | GNUNET_i2s(&e_ctx->n->id), e_ctx->e->name); |
221 | GNUNET_free (e_ctx); | 221 | GNUNET_free (e_ctx); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
@@ -233,10 +233,10 @@ static void | |||
233 | remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 233 | remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
234 | { | 234 | { |
235 | struct Node *n = cls; | 235 | struct Node *n = cls; |
236 | 236 | ||
237 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 237 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
238 | "Removing request for peer %s due to timeout\n", | 238 | "Removing request for peer %s due to timeout\n", |
239 | GNUNET_i2s (&n->id)); | 239 | GNUNET_i2s (&n->id)); |
240 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, &n->id)) | 240 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, &n->id)) |
241 | { | 241 | { |
242 | GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_requested, &n->id, n)); | 242 | GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_requested, &n->id, n)); |
@@ -271,7 +271,7 @@ append_public_key (void *cls, | |||
271 | * @param buf the buffer to copy to | 271 | * @param buf the buffer to copy to |
272 | * @return bytes passed | 272 | * @return bytes passed |
273 | */ | 273 | */ |
274 | static size_t | 274 | static size_t |
275 | send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) | 275 | send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) |
276 | { | 276 | { |
277 | struct Node *n = cls; | 277 | struct Node *n = cls; |
@@ -315,22 +315,22 @@ send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) | |||
315 | * | 315 | * |
316 | * @param peer the peer to send to | 316 | * @param peer the peer to send to |
317 | */ | 317 | */ |
318 | static void | 318 | static void |
319 | send_experimentation_request (const struct GNUNET_PeerIdentity *peer) | 319 | send_experimentation_request (const struct GNUNET_PeerIdentity *peer) |
320 | { | 320 | { |
321 | struct Node *n; | 321 | struct Node *n; |
322 | struct NodeComCtx *e_ctx; | 322 | struct NodeComCtx *e_ctx; |
323 | size_t size; | 323 | size_t size; |
324 | size_t c_issuers; | 324 | size_t c_issuers; |
325 | 325 | ||
326 | c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); | 326 | c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); |
327 | size = sizeof (struct Experimentation_Request) + | 327 | size = sizeof (struct Experimentation_Request) + |
328 | c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); | 328 | c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); |
329 | n = GNUNET_new (struct Node); | 329 | n = GNUNET_new (struct Node); |
330 | n->id = *peer; | 330 | n->id = *peer; |
331 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, &remove_request, n); | 331 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, &remove_request, n); |
332 | n->capabilities = NONE; | 332 | n->capabilities = NONE; |
333 | 333 | ||
334 | e_ctx = GNUNET_new (struct NodeComCtx); | 334 | e_ctx = GNUNET_new (struct NodeComCtx); |
335 | e_ctx->n = n; | 335 | e_ctx->n = n; |
336 | e_ctx->e = NULL; | 336 | e_ctx->e = NULL; |
@@ -339,10 +339,10 @@ send_experimentation_request (const struct GNUNET_PeerIdentity *peer) | |||
339 | e_ctx->notify_cls = n; | 339 | e_ctx->notify_cls = n; |
340 | GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); | 340 | GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); |
341 | schedule_transmisson (e_ctx); | 341 | schedule_transmisson (e_ctx); |
342 | 342 | ||
343 | GNUNET_assert (GNUNET_OK == | 343 | GNUNET_assert (GNUNET_OK == |
344 | GNUNET_CONTAINER_multipeermap_put (nodes_requested, | 344 | GNUNET_CONTAINER_multipeermap_put (nodes_requested, |
345 | peer, n, | 345 | peer, n, |
346 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); | 346 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); |
347 | update_stats (nodes_requested); | 347 | update_stats (nodes_requested); |
348 | } | 348 | } |
@@ -361,17 +361,17 @@ send_response_cb (void *cls, size_t bufsize, void *buf) | |||
361 | { | 361 | { |
362 | struct Node *n = cls; | 362 | struct Node *n = cls; |
363 | struct Experimentation_Response msg; | 363 | struct Experimentation_Response msg; |
364 | size_t c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); | 364 | size_t c_issuers = GNUNET_CONTAINER_multihashmap_size (valid_issuers); |
365 | size_t ri_size = c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); | 365 | size_t ri_size = c_issuers * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); |
366 | size_t msg_size = sizeof (msg); | 366 | size_t msg_size = sizeof (msg); |
367 | size_t total_size = msg_size + ri_size; | 367 | size_t total_size = msg_size + ri_size; |
368 | struct GNUNET_CRYPTO_EccPublicSignKey *issuers; | 368 | struct GNUNET_CRYPTO_EccPublicSignKey *issuers; |
369 | 369 | ||
370 | n->cth = NULL; | 370 | n->cth = NULL; |
371 | if (buf == NULL) | 371 | if (buf == NULL) |
372 | { | 372 | { |
373 | /* client disconnected */ | 373 | /* client disconnected */ |
374 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 374 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
375 | "Client disconnected\n"); | 375 | "Client disconnected\n"); |
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
@@ -399,7 +399,7 @@ get_experiments_cb (struct Node *n, struct Experiment *e) | |||
399 | static int counter = 0; | 399 | static int counter = 0; |
400 | if (NULL == e) | 400 | if (NULL == e) |
401 | return; /* Done */ | 401 | return; /* Done */ |
402 | 402 | ||
403 | /* Tell the scheduler to add a node with an experiment */ | 403 | /* Tell the scheduler to add a node with an experiment */ |
404 | GED_scheduler_add (n, e, GNUNET_YES); | 404 | GED_scheduler_add (n, e, GNUNET_YES); |
405 | counter ++; | 405 | counter ++; |
@@ -417,19 +417,19 @@ get_node (const struct GNUNET_PeerIdentity *id) | |||
417 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_active, id); | 417 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_active, id); |
418 | if (res == NULL) | 418 | if (res == NULL) |
419 | res = tmp; | 419 | res = tmp; |
420 | 420 | ||
421 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, id); | 421 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, id); |
422 | if (res == NULL) | 422 | if (res == NULL) |
423 | res = tmp; | 423 | res = tmp; |
424 | else | 424 | else |
425 | GNUNET_break (0); /* Multiple instances */ | 425 | GNUNET_break (0); /* Multiple instances */ |
426 | 426 | ||
427 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_requested, id); | 427 | tmp = GNUNET_CONTAINER_multipeermap_get (nodes_requested, id); |
428 | if (res == NULL) | 428 | if (res == NULL) |
429 | res = tmp; | 429 | res = tmp; |
430 | else | 430 | else |
431 | GNUNET_break (0); /* Multiple instances */ | 431 | GNUNET_break (0); /* Multiple instances */ |
432 | 432 | ||
433 | return res; | 433 | return res; |
434 | } | 434 | } |
435 | 435 | ||
@@ -439,7 +439,7 @@ get_node (const struct GNUNET_PeerIdentity *id) | |||
439 | * | 439 | * |
440 | * @param n the node | 440 | * @param n the node |
441 | */ | 441 | */ |
442 | static void | 442 | static void |
443 | node_make_active (struct Node *n) | 443 | node_make_active (struct Node *n) |
444 | { | 444 | { |
445 | int c1; | 445 | int c1; |
@@ -452,7 +452,7 @@ node_make_active (struct Node *n) | |||
452 | GNUNET_i2s (&n->id)); | 452 | GNUNET_i2s (&n->id)); |
453 | /* Request experiments for this node to start them */ | 453 | /* Request experiments for this node to start them */ |
454 | for (c1 = 0; c1 < n->issuer_count; c1++) | 454 | for (c1 = 0; c1 < n->issuer_count; c1++) |
455 | { | 455 | { |
456 | GED_experiments_get (n, &n->issuer_id[c1], &get_experiments_cb); | 456 | GED_experiments_get (n, &n->issuer_id[c1], &get_experiments_cb); |
457 | } | 457 | } |
458 | } | 458 | } |
@@ -478,20 +478,20 @@ handle_request (const struct GNUNET_PeerIdentity *peer, | |||
478 | uint32_t ic; | 478 | uint32_t ic; |
479 | uint32_t ic_accepted; | 479 | uint32_t ic_accepted; |
480 | int make_active; | 480 | int make_active; |
481 | 481 | ||
482 | if (ntohs (message->size) < sizeof (struct Experimentation_Request)) | 482 | if (ntohs (message->size) < sizeof (struct Experimentation_Request)) |
483 | { | 483 | { |
484 | GNUNET_break (0); | 484 | GNUNET_break (0); |
485 | return; | 485 | return; |
486 | } | 486 | } |
487 | ic = ntohl (rm->issuer_count); | 487 | ic = ntohl (rm->issuer_count); |
488 | if (ntohs (message->size) != | 488 | if (ntohs (message->size) != |
489 | sizeof (struct Experimentation_Request) + ic * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) | 489 | sizeof (struct Experimentation_Request) + ic * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) |
490 | { | 490 | { |
491 | GNUNET_break (0); | 491 | GNUNET_break (0); |
492 | return; | 492 | return; |
493 | } | 493 | } |
494 | 494 | ||
495 | make_active = GNUNET_NO; | 495 | make_active = GNUNET_NO; |
496 | if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) | 496 | if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) |
497 | { | 497 | { |
@@ -522,10 +522,10 @@ handle_request (const struct GNUNET_PeerIdentity *peer, | |||
522 | n->capabilities = NONE; | 522 | n->capabilities = NONE; |
523 | make_active = GNUNET_YES; | 523 | make_active = GNUNET_YES; |
524 | } | 524 | } |
525 | 525 | ||
526 | /* Update node */ | 526 | /* Update node */ |
527 | n->capabilities = ntohl (rm->capabilities); | 527 | n->capabilities = ntohl (rm->capabilities); |
528 | 528 | ||
529 | /* Filter accepted issuer */ | 529 | /* Filter accepted issuer */ |
530 | ic_accepted = 0; | 530 | ic_accepted = 0; |
531 | for (c1 = 0; c1 < ic; c1++) | 531 | for (c1 = 0; c1 < ic; c1++) |
@@ -533,7 +533,7 @@ handle_request (const struct GNUNET_PeerIdentity *peer, | |||
533 | if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1])) | 533 | if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1])) |
534 | ic_accepted ++; | 534 | ic_accepted ++; |
535 | } | 535 | } |
536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
537 | "Request from peer `%s' with %u issuers, we accepted %u issuer \n", | 537 | "Request from peer `%s' with %u issuers, we accepted %u issuer \n", |
538 | GNUNET_i2s (peer), ic, ic_accepted); | 538 | GNUNET_i2s (peer), ic, ic_accepted); |
539 | GNUNET_free_non_null (n->issuer_id); | 539 | GNUNET_free_non_null (n->issuer_id); |
@@ -548,19 +548,19 @@ handle_request (const struct GNUNET_PeerIdentity *peer, | |||
548 | } | 548 | } |
549 | } | 549 | } |
550 | n->issuer_count = ic_accepted; | 550 | n->issuer_count = ic_accepted; |
551 | 551 | ||
552 | if (GNUNET_YES == make_active) | 552 | if (GNUNET_YES == make_active) |
553 | node_make_active (n); | 553 | node_make_active (n); |
554 | 554 | ||
555 | /* Send response */ | 555 | /* Send response */ |
556 | e_ctx = GNUNET_new (struct NodeComCtx); | 556 | e_ctx = GNUNET_new (struct NodeComCtx); |
557 | e_ctx->n = n; | 557 | e_ctx->n = n; |
558 | e_ctx->e = NULL; | 558 | e_ctx->e = NULL; |
559 | e_ctx->size = sizeof (struct Experimentation_Response) + | 559 | e_ctx->size = sizeof (struct Experimentation_Response) + |
560 | my_issuer_count * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); | 560 | my_issuer_count * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); |
561 | e_ctx->notify = &send_response_cb; | 561 | e_ctx->notify = &send_response_cb; |
562 | e_ctx->notify_cls = n; | 562 | e_ctx->notify_cls = n; |
563 | 563 | ||
564 | GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); | 564 | GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); |
565 | schedule_transmisson (e_ctx); | 565 | schedule_transmisson (e_ctx); |
566 | } | 566 | } |
@@ -583,7 +583,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
583 | int make_active; | 583 | int make_active; |
584 | unsigned int c1; | 584 | unsigned int c1; |
585 | unsigned int c2; | 585 | unsigned int c2; |
586 | 586 | ||
587 | if (ntohs (message->size) < sizeof (struct Experimentation_Response)) | 587 | if (ntohs (message->size) < sizeof (struct Experimentation_Response)) |
588 | { | 588 | { |
589 | GNUNET_break (0); | 589 | GNUNET_break (0); |
@@ -595,7 +595,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
595 | GNUNET_break (0); | 595 | GNUNET_break (0); |
596 | return; | 596 | return; |
597 | } | 597 | } |
598 | 598 | ||
599 | make_active = GNUNET_NO; | 599 | make_active = GNUNET_NO; |
600 | if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) | 600 | if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer))) |
601 | { | 601 | { |
@@ -618,7 +618,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
618 | } | 618 | } |
619 | else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer))) | 619 | else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer))) |
620 | { | 620 | { |
621 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 621 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
622 | "Received %s from peer `%s'\n", | 622 | "Received %s from peer `%s'\n", |
623 | "RESPONSE", "inactive", GNUNET_i2s (peer)); | 623 | "RESPONSE", "inactive", GNUNET_i2s (peer)); |
624 | GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_inactive, peer, n)); | 624 | GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_inactive, peer, n)); |
@@ -631,10 +631,10 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
631 | "RESPONSE", "unknown", GNUNET_i2s (peer)); | 631 | "RESPONSE", "unknown", GNUNET_i2s (peer)); |
632 | return; | 632 | return; |
633 | } | 633 | } |
634 | 634 | ||
635 | /* Update */ | 635 | /* Update */ |
636 | n->capabilities = ntohl (rm->capabilities); | 636 | n->capabilities = ntohl (rm->capabilities); |
637 | 637 | ||
638 | /* Filter accepted issuer */ | 638 | /* Filter accepted issuer */ |
639 | ic_accepted = 0; | 639 | ic_accepted = 0; |
640 | for (c1 = 0; c1 < ic; c1++) | 640 | for (c1 = 0; c1 < ic; c1++) |
@@ -657,7 +657,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
657 | } | 657 | } |
658 | } | 658 | } |
659 | n->issuer_count = ic_accepted; | 659 | n->issuer_count = ic_accepted; |
660 | 660 | ||
661 | if (GNUNET_YES == make_active) | 661 | if (GNUNET_YES == make_active) |
662 | node_make_active (n); | 662 | node_make_active (n); |
663 | } | 663 | } |
@@ -669,7 +669,7 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer, | |||
669 | * @param peer the source | 669 | * @param peer the source |
670 | * @param message the message | 670 | * @param message the message |
671 | */ | 671 | */ |
672 | static void | 672 | static void |
673 | handle_start (const struct GNUNET_PeerIdentity *peer, | 673 | handle_start (const struct GNUNET_PeerIdentity *peer, |
674 | const struct GNUNET_MessageHeader *message) | 674 | const struct GNUNET_MessageHeader *message) |
675 | { | 675 | { |
@@ -679,7 +679,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer, | |||
679 | const char *name; | 679 | const char *name; |
680 | struct Node *n; | 680 | struct Node *n; |
681 | struct Experiment *e; | 681 | struct Experiment *e; |
682 | 682 | ||
683 | if (NULL == peer) | 683 | if (NULL == peer) |
684 | { | 684 | { |
685 | GNUNET_break (0); | 685 | GNUNET_break (0); |
@@ -690,7 +690,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer, | |||
690 | GNUNET_break (0); | 690 | GNUNET_break (0); |
691 | return; | 691 | return; |
692 | } | 692 | } |
693 | 693 | ||
694 | size = ntohs (message->size); | 694 | size = ntohs (message->size); |
695 | if (size < sizeof (struct GED_start_message)) | 695 | if (size < sizeof (struct GED_start_message)) |
696 | { | 696 | { |
@@ -704,7 +704,7 @@ handle_start (const struct GNUNET_PeerIdentity *peer, | |||
704 | GNUNET_break (0); | 704 | GNUNET_break (0); |
705 | return; | 705 | return; |
706 | } | 706 | } |
707 | 707 | ||
708 | n = get_node (peer); | 708 | n = get_node (peer); |
709 | if (NULL == n) | 709 | if (NULL == n) |
710 | { | 710 | { |
@@ -716,18 +716,18 @@ handle_start (const struct GNUNET_PeerIdentity *peer, | |||
716 | { | 716 | { |
717 | GNUNET_break (0); | 717 | GNUNET_break (0); |
718 | return; | 718 | return; |
719 | } | 719 | } |
720 | if (name_len != strlen (name) + 1) | 720 | if (name_len != strlen (name) + 1) |
721 | { | 721 | { |
722 | GNUNET_break (0); | 722 | GNUNET_break (0); |
723 | return; | 723 | return; |
724 | } | 724 | } |
725 | e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); | 725 | e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); |
726 | if (NULL == e) | 726 | if (NULL == e) |
727 | { | 727 | { |
728 | GNUNET_break (0); | 728 | GNUNET_break (0); |
729 | return; | 729 | return; |
730 | } | 730 | } |
731 | GED_scheduler_handle_start (n, e); | 731 | GED_scheduler_handle_start (n, e); |
732 | } | 732 | } |
733 | 733 | ||
@@ -748,7 +748,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, | |||
748 | const char *name; | 748 | const char *name; |
749 | struct Node *n; | 749 | struct Node *n; |
750 | struct Experiment *e; | 750 | struct Experiment *e; |
751 | 751 | ||
752 | if (NULL == peer) | 752 | if (NULL == peer) |
753 | { | 753 | { |
754 | GNUNET_break (0); | 754 | GNUNET_break (0); |
@@ -759,7 +759,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, | |||
759 | GNUNET_break (0); | 759 | GNUNET_break (0); |
760 | return; | 760 | return; |
761 | } | 761 | } |
762 | 762 | ||
763 | size = ntohs (message->size); | 763 | size = ntohs (message->size); |
764 | if (size < sizeof (struct GED_start_ack_message)) | 764 | if (size < sizeof (struct GED_start_ack_message)) |
765 | { | 765 | { |
@@ -773,7 +773,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, | |||
773 | GNUNET_break (0); | 773 | GNUNET_break (0); |
774 | return; | 774 | return; |
775 | } | 775 | } |
776 | 776 | ||
777 | n = get_node (peer); | 777 | n = get_node (peer); |
778 | if (NULL == n) | 778 | if (NULL == n) |
779 | { | 779 | { |
@@ -791,7 +791,7 @@ handle_start_ack (const struct GNUNET_PeerIdentity *peer, | |||
791 | GNUNET_break (0); | 791 | GNUNET_break (0); |
792 | return; | 792 | return; |
793 | } | 793 | } |
794 | 794 | ||
795 | e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); | 795 | e = GED_experiments_find (&msg->issuer, name, GNUNET_TIME_absolute_ntoh(msg->version_nbo)); |
796 | if (NULL == e) | 796 | if (NULL == e) |
797 | { | 797 | { |
@@ -885,19 +885,19 @@ core_connect_handler (void *cls, | |||
885 | { | 885 | { |
886 | if (GNUNET_YES == is_me(peer)) | 886 | if (GNUNET_YES == is_me(peer)) |
887 | return; | 887 | return; |
888 | 888 | ||
889 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to peer %s\n"), | 889 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to peer %s\n"), |
890 | GNUNET_i2s (peer)); | 890 | GNUNET_i2s (peer)); |
891 | 891 | ||
892 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, peer)) | 892 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, peer)) |
893 | return; /* We already sent a request */ | 893 | return; /* We already sent a request */ |
894 | 894 | ||
895 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_active, peer)) | 895 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_active, peer)) |
896 | return; /* This peer is known as active */ | 896 | return; /* This peer is known as active */ |
897 | 897 | ||
898 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_inactive, peer)) | 898 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_inactive, peer)) |
899 | return; /* This peer is known as inactive */ | 899 | return; /* This peer is known as inactive */ |
900 | 900 | ||
901 | send_experimentation_request (peer); | 901 | send_experimentation_request (peer); |
902 | } | 902 | } |
903 | 903 | ||