diff options
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/include/gnunet_peerinfo_service.h | 40 | ||||
-rw-r--r-- | src/peerinfo-tool/gnunet-peerinfo.c | 2 | ||||
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 136 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_hello.c | 2 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 4 |
6 files changed, 108 insertions, 77 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 1a4e58826..1f10a51b7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -28,6 +28,7 @@ SUBDIRS = \ | |||
28 | block \ | 28 | block \ |
29 | statistics \ | 29 | statistics \ |
30 | arm \ | 30 | arm \ |
31 | lockmanager \ | ||
31 | peerinfo \ | 32 | peerinfo \ |
32 | $(MYSQL_DIR) \ | 33 | $(MYSQL_DIR) \ |
33 | $(POSTGRES_DIR) \ | 34 | $(POSTGRES_DIR) \ |
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h index 12264fb1f..49ba91600 100644 --- a/src/include/gnunet_peerinfo_service.h +++ b/src/include/gnunet_peerinfo_service.h | |||
@@ -58,7 +58,6 @@ struct GNUNET_PEERINFO_Handle * | |||
58 | GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | 58 | GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); |
59 | 59 | ||
60 | 60 | ||
61 | |||
62 | /** | 61 | /** |
63 | * Disconnect from the peerinfo service. Note that all iterators must | 62 | * Disconnect from the peerinfo service. Note that all iterators must |
64 | * have completed or have been cancelled by the time this function is | 63 | * have completed or have been cancelled by the time this function is |
@@ -73,6 +72,22 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h); | |||
73 | 72 | ||
74 | 73 | ||
75 | /** | 74 | /** |
75 | * Continuation called with a status result. | ||
76 | * | ||
77 | * @param cls closure | ||
78 | * @param emsg error message, NULL on success | ||
79 | */ | ||
80 | typedef void (*GNUNET_PEERINFO_Continuation)(void *cls, | ||
81 | const char *emsg); | ||
82 | |||
83 | |||
84 | /** | ||
85 | * Opaque handle to cancel 'add' operation. | ||
86 | */ | ||
87 | struct GNUNET_PEERINFO_AddContext; | ||
88 | |||
89 | |||
90 | /** | ||
76 | * Add a host to the persistent list. This method operates in | 91 | * Add a host to the persistent list. This method operates in |
77 | * semi-reliable mode: if the transmission is not completed by | 92 | * semi-reliable mode: if the transmission is not completed by |
78 | * the time 'GNUNET_PEERINFO_disconnect' is called, it will be | 93 | * the time 'GNUNET_PEERINFO_disconnect' is called, it will be |
@@ -82,10 +97,29 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h); | |||
82 | * | 97 | * |
83 | * @param h handle to the peerinfo service | 98 | * @param h handle to the peerinfo service |
84 | * @param hello the verified (!) HELLO message | 99 | * @param hello the verified (!) HELLO message |
100 | * @param cont continuation to call when done, NULL is allowed | ||
101 | * @param cont_cls closure for 'cont' | ||
102 | * @return handle to cancel add operation; all pending | ||
103 | * 'add' operations will be cancelled automatically | ||
104 | * on disconnect, so it is not necessary to keep this | ||
105 | * handle (unless 'cont' is NULL and at some point | ||
106 | * calling 'cont' must be prevented) | ||
85 | */ | 107 | */ |
86 | void | 108 | struct GNUNET_PEERINFO_AddContext * |
87 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, | 109 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, |
88 | const struct GNUNET_HELLO_Message *hello); | 110 | const struct GNUNET_HELLO_Message *hello, |
111 | GNUNET_PEERINFO_Continuation cont, | ||
112 | void *cont_cls); | ||
113 | |||
114 | |||
115 | /** | ||
116 | * Cancel pending 'add' operation. Must only be called before | ||
117 | * either 'cont' or 'GNUNET_PEERINFO_disconnect' are invoked. | ||
118 | * | ||
119 | * @param ac handle for the add operation to cancel | ||
120 | */ | ||
121 | void | ||
122 | GNUNET_PEERINFO_add_peer_cancel (struct GNUNET_PEERINFO_AddContext *ac); | ||
89 | 123 | ||
90 | 124 | ||
91 | /** | 125 | /** |
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index ab5a15730..5f9e2cefa 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c | |||
@@ -699,7 +699,7 @@ parse_hello_uri (const char *put_uri) | |||
699 | { | 699 | { |
700 | /* WARNING: this adds the address from URI WITHOUT verification! */ | 700 | /* WARNING: this adds the address from URI WITHOUT verification! */ |
701 | if (GNUNET_OK == ctx.ret) | 701 | if (GNUNET_OK == ctx.ret) |
702 | GNUNET_PEERINFO_add_peer (peerinfo, hello); | 702 | GNUNET_PEERINFO_add_peer (peerinfo, hello, NULL, NULL); |
703 | GNUNET_free (hello); | 703 | GNUNET_free (hello); |
704 | } | 704 | } |
705 | 705 | ||
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 4564df727..f70b8fde1 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -33,35 +33,28 @@ | |||
33 | 33 | ||
34 | #define LOG(kind,...) GNUNET_log_from (kind, "peerinfo-api",__VA_ARGS__) | 34 | #define LOG(kind,...) GNUNET_log_from (kind, "peerinfo-api",__VA_ARGS__) |
35 | 35 | ||
36 | /** | ||
37 | * Function to call after transmission has succeeded. | ||
38 | * | ||
39 | * @param cls closure | ||
40 | * @param success GNUNET_OK if transmission worked, GNUNET_SYSERR on error | ||
41 | */ | ||
42 | typedef void (*TransmissionContinuation) (void *cls, int success); | ||
43 | |||
44 | 36 | ||
45 | /** | 37 | /** |
46 | * Entry in the transmission queue to PEERINFO service. | 38 | * Entry in the transmission queue to PEERINFO service. We use |
39 | * the same structure for queueing 'iteration' requests and | ||
40 | * actual 'add' messages. | ||
47 | */ | 41 | */ |
48 | struct TransmissionQueueEntry | 42 | struct GNUNET_PEERINFO_AddContext |
49 | { | 43 | { |
50 | /** | 44 | /** |
51 | * This is a linked list. | 45 | * This is a linked list. |
52 | */ | 46 | */ |
53 | struct TransmissionQueueEntry *next; | 47 | struct GNUNET_PEERINFO_AddContext *next; |
54 | 48 | ||
55 | /** | 49 | /** |
56 | * This is a linked list. | 50 | * This is a linked list. |
57 | */ | 51 | */ |
58 | struct TransmissionQueueEntry *prev; | 52 | struct GNUNET_PEERINFO_AddContext *prev; |
59 | 53 | ||
60 | /** | 54 | /** |
61 | * Function to call after request has been transmitted, or NULL (in which | 55 | * Function to call after request has been transmitted, or NULL. |
62 | * case we must consider sending the next entry immediately). | ||
63 | */ | 56 | */ |
64 | TransmissionContinuation cont; | 57 | GNUNET_PEERINFO_Continuation cont; |
65 | 58 | ||
66 | /** | 59 | /** |
67 | * Closure for 'cont'. | 60 | * Closure for 'cont'. |
@@ -110,7 +103,7 @@ struct GNUNET_PEERINFO_IteratorContext | |||
110 | /** | 103 | /** |
111 | * Our entry in the transmission queue. | 104 | * Our entry in the transmission queue. |
112 | */ | 105 | */ |
113 | struct TransmissionQueueEntry *tqe; | 106 | struct GNUNET_PEERINFO_AddContext *ac; |
114 | 107 | ||
115 | /** | 108 | /** |
116 | * Task responsible for timeout. | 109 | * Task responsible for timeout. |
@@ -147,12 +140,12 @@ struct GNUNET_PEERINFO_Handle | |||
147 | /** | 140 | /** |
148 | * Head of transmission queue. | 141 | * Head of transmission queue. |
149 | */ | 142 | */ |
150 | struct TransmissionQueueEntry *tq_head; | 143 | struct GNUNET_PEERINFO_AddContext *ac_head; |
151 | 144 | ||
152 | /** | 145 | /** |
153 | * Tail of transmission queue. | 146 | * Tail of transmission queue. |
154 | */ | 147 | */ |
155 | struct TransmissionQueueEntry *tq_tail; | 148 | struct GNUNET_PEERINFO_AddContext *ac_tail; |
156 | 149 | ||
157 | /** | 150 | /** |
158 | * Handle for the current transmission request, or NULL if none is pending. | 151 | * Handle for the current transmission request, or NULL if none is pending. |
@@ -214,7 +207,7 @@ GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
214 | void | 207 | void |
215 | GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h) | 208 | GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h) |
216 | { | 209 | { |
217 | struct TransmissionQueueEntry *tqe; | 210 | struct GNUNET_PEERINFO_AddContext *ac; |
218 | struct GNUNET_PEERINFO_IteratorContext *ic; | 211 | struct GNUNET_PEERINFO_IteratorContext *ic; |
219 | 212 | ||
220 | while (NULL != (ic = h->ic_head)) | 213 | while (NULL != (ic = h->ic_head)) |
@@ -223,12 +216,12 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h) | |||
223 | ic->in_receive = GNUNET_NO; | 216 | ic->in_receive = GNUNET_NO; |
224 | GNUNET_PEERINFO_iterate_cancel (ic); | 217 | GNUNET_PEERINFO_iterate_cancel (ic); |
225 | } | 218 | } |
226 | while (NULL != (tqe = h->tq_head)) | 219 | while (NULL != (ac = h->ac_head)) |
227 | { | 220 | { |
228 | GNUNET_CONTAINER_DLL_remove (h->tq_head, h->tq_tail, tqe); | 221 | GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac); |
229 | if (tqe->cont != NULL) | 222 | if (NULL != ac->cont) |
230 | tqe->cont (tqe->cont_cls, GNUNET_SYSERR); | 223 | ac->cont (ac->cont_cls, _("aborted due to explicit disconnect request")); |
231 | GNUNET_free (tqe); | 224 | GNUNET_free (ac); |
232 | } | 225 | } |
233 | if (NULL != h->th) | 226 | if (NULL != h->th) |
234 | { | 227 | { |
@@ -333,25 +326,25 @@ static size_t | |||
333 | do_transmit (void *cls, size_t size, void *buf) | 326 | do_transmit (void *cls, size_t size, void *buf) |
334 | { | 327 | { |
335 | struct GNUNET_PEERINFO_Handle *h = cls; | 328 | struct GNUNET_PEERINFO_Handle *h = cls; |
336 | struct TransmissionQueueEntry *tqe = h->tq_head; | 329 | struct GNUNET_PEERINFO_AddContext *ac = h->ac_head; |
337 | size_t ret; | 330 | size_t ret; |
338 | 331 | ||
339 | h->th = NULL; | 332 | h->th = NULL; |
340 | if (NULL == tqe) | 333 | if (NULL == ac) |
341 | return 0; /* request was cancelled in the meantime */ | 334 | return 0; /* request was cancelled in the meantime */ |
342 | if (NULL == buf) | 335 | if (NULL == buf) |
343 | { | 336 | { |
344 | /* peerinfo service died */ | 337 | /* peerinfo service died */ |
345 | LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 338 | LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
346 | "Failed to transmit message to `%s' service.\n", "PEERINFO"); | 339 | "Failed to transmit message to `%s' service.\n", "PEERINFO"); |
347 | GNUNET_CONTAINER_DLL_remove (h->tq_head, h->tq_tail, tqe); | 340 | GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac); |
348 | reconnect (h); | 341 | reconnect (h); |
349 | if (NULL != tqe->cont) | 342 | if (NULL != ac->cont) |
350 | tqe->cont (tqe->cont_cls, GNUNET_SYSERR); | 343 | ac->cont (ac->cont_cls, _("failed to transmit request (service down?)")); |
351 | GNUNET_free (tqe); | 344 | GNUNET_free (ac); |
352 | return 0; | 345 | return 0; |
353 | } | 346 | } |
354 | ret = tqe->size; | 347 | ret = ac->size; |
355 | if (size < ret) | 348 | if (size < ret) |
356 | { | 349 | { |
357 | /* change in head of queue (i.e. cancel + add), try again */ | 350 | /* change in head of queue (i.e. cancel + add), try again */ |
@@ -360,13 +353,12 @@ do_transmit (void *cls, size_t size, void *buf) | |||
360 | } | 353 | } |
361 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 354 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
362 | "Transmitting request of size %u to `%s' service.\n", ret, "PEERINFO"); | 355 | "Transmitting request of size %u to `%s' service.\n", ret, "PEERINFO"); |
363 | memcpy (buf, &tqe[1], ret); | 356 | memcpy (buf, &ac[1], ret); |
364 | GNUNET_CONTAINER_DLL_remove (h->tq_head, h->tq_tail, tqe); | 357 | GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac); |
365 | if (NULL != tqe->cont) | 358 | trigger_transmit (h); |
366 | tqe->cont (tqe->cont_cls, GNUNET_OK); | 359 | if (NULL != ac->cont) |
367 | else | 360 | ac->cont (ac->cont_cls, NULL); |
368 | trigger_transmit (h); | 361 | GNUNET_free (ac); |
369 | GNUNET_free (tqe); | ||
370 | return ret; | 362 | return ret; |
371 | } | 363 | } |
372 | 364 | ||
@@ -380,9 +372,9 @@ do_transmit (void *cls, size_t size, void *buf) | |||
380 | static void | 372 | static void |
381 | trigger_transmit (struct GNUNET_PEERINFO_Handle *h) | 373 | trigger_transmit (struct GNUNET_PEERINFO_Handle *h) |
382 | { | 374 | { |
383 | struct TransmissionQueueEntry *tqe; | 375 | struct GNUNET_PEERINFO_AddContext *ac; |
384 | 376 | ||
385 | if (NULL == (tqe = h->tq_head)) | 377 | if (NULL == (ac = h->ac_head)) |
386 | return; /* no requests queued */ | 378 | return; /* no requests queued */ |
387 | if (NULL != h->th) | 379 | if (NULL != h->th) |
388 | return; /* request already pending */ | 380 | return; /* request already pending */ |
@@ -395,7 +387,7 @@ trigger_transmit (struct GNUNET_PEERINFO_Handle *h) | |||
395 | return; | 387 | return; |
396 | } | 388 | } |
397 | h->th = | 389 | h->th = |
398 | GNUNET_CLIENT_notify_transmit_ready (h->client, tqe->size, | 390 | GNUNET_CLIENT_notify_transmit_ready (h->client, ac->size, |
399 | GNUNET_TIME_UNIT_FOREVER_REL, | 391 | GNUNET_TIME_UNIT_FOREVER_REL, |
400 | GNUNET_YES, | 392 | GNUNET_YES, |
401 | &do_transmit, h); | 393 | &do_transmit, h); |
@@ -413,23 +405,28 @@ trigger_transmit (struct GNUNET_PEERINFO_Handle *h) | |||
413 | * @param h handle to the peerinfo service | 405 | * @param h handle to the peerinfo service |
414 | * @param hello the verified (!) HELLO message | 406 | * @param hello the verified (!) HELLO message |
415 | */ | 407 | */ |
416 | void | 408 | struct GNUNET_PEERINFO_AddContext * |
417 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, | 409 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, |
418 | const struct GNUNET_HELLO_Message *hello) | 410 | const struct GNUNET_HELLO_Message *hello, |
411 | GNUNET_PEERINFO_Continuation cont, | ||
412 | void *cont_cls) | ||
419 | { | 413 | { |
420 | uint16_t hs = GNUNET_HELLO_size (hello); | 414 | uint16_t hs = GNUNET_HELLO_size (hello); |
421 | struct TransmissionQueueEntry *tqe; | 415 | struct GNUNET_PEERINFO_AddContext *ac; |
422 | struct GNUNET_PeerIdentity peer; | 416 | struct GNUNET_PeerIdentity peer; |
423 | 417 | ||
424 | GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_id (hello, &peer)); | 418 | GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_id (hello, &peer)); |
425 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 419 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
426 | "Adding peer `%s' to PEERINFO database (%u bytes of `%s')\n", | 420 | "Adding peer `%s' to PEERINFO database (%u bytes of `%s')\n", |
427 | GNUNET_i2s (&peer), hs, "HELLO"); | 421 | GNUNET_i2s (&peer), hs, "HELLO"); |
428 | tqe = GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + hs); | 422 | ac = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + hs); |
429 | tqe->size = hs; | 423 | ac->size = hs; |
430 | memcpy (&tqe[1], hello, hs); | 424 | ac->cont = cont; |
431 | GNUNET_CONTAINER_DLL_insert_after (h->tq_head, h->tq_tail, h->tq_tail, tqe); | 425 | ac->cont_cls = cont_cls; |
426 | memcpy (&ac[1], hello, hs); | ||
427 | GNUNET_CONTAINER_DLL_insert_after (h->ac_head, h->ac_tail, h->ac_tail, ac); | ||
432 | trigger_transmit (h); | 428 | trigger_transmit (h); |
429 | return ac; | ||
433 | } | 430 | } |
434 | 431 | ||
435 | 432 | ||
@@ -528,26 +525,25 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
528 | * the results (or handle transmission error). | 525 | * the results (or handle transmission error). |
529 | * | 526 | * |
530 | * @param cls the 'struct GNUNET_PEERINFO_IteratorContext' | 527 | * @param cls the 'struct GNUNET_PEERINFO_IteratorContext' |
531 | * @param transmit_success GNUNET_OK if transmission worked | 528 | * @param emsg error message, NULL if transmission worked |
532 | */ | 529 | */ |
533 | static void | 530 | static void |
534 | iterator_start_receive (void *cls, int transmit_success) | 531 | iterator_start_receive (void *cls, const char *emsg) |
535 | { | 532 | { |
536 | struct GNUNET_PEERINFO_IteratorContext *ic = cls; | 533 | struct GNUNET_PEERINFO_IteratorContext *ic = cls; |
537 | struct GNUNET_PEERINFO_Handle *h = ic->h; | 534 | struct GNUNET_PEERINFO_Handle *h = ic->h; |
538 | GNUNET_PEERINFO_Processor cb; | 535 | GNUNET_PEERINFO_Processor cb; |
539 | void *cb_cls; | 536 | void *cb_cls; |
540 | 537 | ||
541 | ic->tqe = NULL; | 538 | ic->ac = NULL; |
542 | if (GNUNET_OK != transmit_success) | 539 | if (NULL != emsg) |
543 | { | 540 | { |
544 | cb = ic->callback; | 541 | cb = ic->callback; |
545 | cb_cls = ic->callback_cls; | 542 | cb_cls = ic->callback_cls; |
546 | GNUNET_PEERINFO_iterate_cancel (ic); | 543 | GNUNET_PEERINFO_iterate_cancel (ic); |
547 | reconnect (h); | 544 | reconnect (h); |
548 | if (NULL != cb) | 545 | if (NULL != cb) |
549 | cb (cb_cls, NULL, NULL, | 546 | cb (cb_cls, NULL, NULL, emsg); |
550 | _("Failed to transmit iteration request to `PEERINFO' service")); | ||
551 | return; | 547 | return; |
552 | } | 548 | } |
553 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Waiting for response from `%s' service.\n", | 549 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Waiting for response from `%s' service.\n", |
@@ -607,17 +603,17 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, | |||
607 | struct GNUNET_MessageHeader *lapm; | 603 | struct GNUNET_MessageHeader *lapm; |
608 | struct ListPeerMessage *lpm; | 604 | struct ListPeerMessage *lpm; |
609 | struct GNUNET_PEERINFO_IteratorContext *ic; | 605 | struct GNUNET_PEERINFO_IteratorContext *ic; |
610 | struct TransmissionQueueEntry *tqe; | 606 | struct GNUNET_PEERINFO_AddContext *ac; |
611 | 607 | ||
612 | if (NULL == peer) | 608 | if (NULL == peer) |
613 | { | 609 | { |
614 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 610 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
615 | "Requesting list of peers from PEERINFO service\n"); | 611 | "Requesting list of peers from PEERINFO service\n"); |
616 | tqe = | 612 | ac = |
617 | GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + | 613 | GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + |
618 | sizeof (struct GNUNET_MessageHeader)); | 614 | sizeof (struct GNUNET_MessageHeader)); |
619 | tqe->size = sizeof (struct GNUNET_MessageHeader); | 615 | ac->size = sizeof (struct GNUNET_MessageHeader); |
620 | lapm = (struct GNUNET_MessageHeader *) &tqe[1]; | 616 | lapm = (struct GNUNET_MessageHeader *) &ac[1]; |
621 | lapm->size = htons (sizeof (struct GNUNET_MessageHeader)); | 617 | lapm->size = htons (sizeof (struct GNUNET_MessageHeader)); |
622 | lapm->type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL); | 618 | lapm->type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL); |
623 | } | 619 | } |
@@ -626,26 +622,26 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, | |||
626 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 622 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
627 | "Requesting information on peer `%4s' from PEERINFO service\n", | 623 | "Requesting information on peer `%4s' from PEERINFO service\n", |
628 | GNUNET_i2s (peer)); | 624 | GNUNET_i2s (peer)); |
629 | tqe = | 625 | ac = |
630 | GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + | 626 | GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + |
631 | sizeof (struct ListPeerMessage)); | 627 | sizeof (struct ListPeerMessage)); |
632 | tqe->size = sizeof (struct ListPeerMessage); | 628 | ac->size = sizeof (struct ListPeerMessage); |
633 | lpm = (struct ListPeerMessage *) &tqe[1]; | 629 | lpm = (struct ListPeerMessage *) &ac[1]; |
634 | lpm->header.size = htons (sizeof (struct ListPeerMessage)); | 630 | lpm->header.size = htons (sizeof (struct ListPeerMessage)); |
635 | lpm->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_GET); | 631 | lpm->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_GET); |
636 | memcpy (&lpm->peer, peer, sizeof (struct GNUNET_PeerIdentity)); | 632 | memcpy (&lpm->peer, peer, sizeof (struct GNUNET_PeerIdentity)); |
637 | } | 633 | } |
638 | ic = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_IteratorContext)); | 634 | ic = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_IteratorContext)); |
639 | ic->h = h; | 635 | ic->h = h; |
640 | ic->tqe = tqe; | 636 | ic->ac = ac; |
641 | ic->callback = callback; | 637 | ic->callback = callback; |
642 | ic->callback_cls = callback_cls; | 638 | ic->callback_cls = callback_cls; |
643 | ic->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 639 | ic->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
644 | ic->timeout_task = | 640 | ic->timeout_task = |
645 | GNUNET_SCHEDULER_add_delayed (timeout, &signal_timeout, ic); | 641 | GNUNET_SCHEDULER_add_delayed (timeout, &signal_timeout, ic); |
646 | tqe->cont = &iterator_start_receive; | 642 | ac->cont = &iterator_start_receive; |
647 | tqe->cont_cls = ic; | 643 | ac->cont_cls = ic; |
648 | GNUNET_CONTAINER_DLL_insert_after (h->tq_head, h->tq_tail, h->tq_tail, tqe); | 644 | GNUNET_CONTAINER_DLL_insert_after (h->ac_head, h->ac_tail, h->ac_tail, ac); |
649 | GNUNET_CONTAINER_DLL_insert (h->ic_head, | 645 | GNUNET_CONTAINER_DLL_insert (h->ic_head, |
650 | h->ic_tail, | 646 | h->ic_tail, |
651 | ic); | 647 | ic); |
@@ -676,10 +672,10 @@ GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic) | |||
676 | ic->callback = NULL; | 672 | ic->callback = NULL; |
677 | if (GNUNET_YES == ic->in_receive) | 673 | if (GNUNET_YES == ic->in_receive) |
678 | return; /* need to finish processing */ | 674 | return; /* need to finish processing */ |
679 | if (NULL != ic->tqe) | 675 | if (NULL != ic->ac) |
680 | { | 676 | { |
681 | GNUNET_CONTAINER_DLL_remove (h->tq_head, h->tq_tail, ic->tqe); | 677 | GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ic->ac); |
682 | GNUNET_free (ic->tqe); | 678 | GNUNET_free (ic->ac); |
683 | } | 679 | } |
684 | GNUNET_free (ic); | 680 | GNUNET_free (ic); |
685 | } | 681 | } |
diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c index 3e80aec02..3838c511a 100644 --- a/src/transport/gnunet-service-transport_hello.c +++ b/src/transport/gnunet-service-transport_hello.c | |||
@@ -177,7 +177,7 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
177 | GNUNET_NO); | 177 | GNUNET_NO); |
178 | if (NULL != hello_cb) | 178 | if (NULL != hello_cb) |
179 | hello_cb (hello_cb_cls, GST_hello_get ()); | 179 | hello_cb (hello_cb_cls, GST_hello_get ()); |
180 | GNUNET_PEERINFO_add_peer (GST_peerinfo, our_hello); | 180 | GNUNET_PEERINFO_add_peer (GST_peerinfo, our_hello, NULL, NULL); |
181 | hello_task = | 181 | hello_task = |
182 | GNUNET_SCHEDULER_add_delayed (HELLO_REFRESH_PERIOD, &refresh_hello_task, | 182 | GNUNET_SCHEDULER_add_delayed (HELLO_REFRESH_PERIOD, &refresh_hello_task, |
183 | NULL); | 183 | NULL); |
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 99db00561..75ff4eb6f 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -1104,7 +1104,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1104 | /* build HELLO to store in PEERINFO */ | 1104 | /* build HELLO to store in PEERINFO */ |
1105 | ve->copied = GNUNET_NO; | 1105 | ve->copied = GNUNET_NO; |
1106 | hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve); | 1106 | hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve); |
1107 | GNUNET_PEERINFO_add_peer (GST_peerinfo, hello); | 1107 | GNUNET_PEERINFO_add_peer (GST_peerinfo, hello, NULL, NULL); |
1108 | GNUNET_free (hello); | 1108 | GNUNET_free (hello); |
1109 | } | 1109 | } |
1110 | 1110 | ||
@@ -1135,7 +1135,7 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello) | |||
1135 | return; | 1135 | return; |
1136 | /* Add peer identity without addresses to peerinfo service */ | 1136 | /* Add peer identity without addresses to peerinfo service */ |
1137 | h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL); | 1137 | h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL); |
1138 | GNUNET_PEERINFO_add_peer (GST_peerinfo, h); | 1138 | GNUNET_PEERINFO_add_peer (GST_peerinfo, h, NULL, NULL); |
1139 | #if VERBOSE_VALIDATION | 1139 | #if VERBOSE_VALIDATION |
1140 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1140 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1141 | _("Adding `%s' without addresses for peer `%s'\n"), "HELLO", | 1141 | _("Adding `%s' without addresses for peer `%s'\n"), "HELLO", |