diff options
Diffstat (limited to 'src/identity-provider/gnunet-service-identity-provider.c')
-rw-r--r-- | src/identity-provider/gnunet-service-identity-provider.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 59e678b24..0bb400e07 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -105,13 +105,12 @@ static struct GNUNET_NAMESTORE_ZoneIterator *ns_it; | |||
105 | /** | 105 | /** |
106 | * Timeout task | 106 | * Timeout task |
107 | */ | 107 | */ |
108 | static struct GNUNET_SCHEDULER_Task * timeout_task; | 108 | static struct GNUNET_SCHEDULER_Task *timeout_task; |
109 | |||
110 | 109 | ||
111 | /** | 110 | /** |
112 | * Update task | 111 | * Update task |
113 | */ | 112 | */ |
114 | static struct GNUNET_SCHEDULER_Task * update_task; | 113 | static struct GNUNET_SCHEDULER_Task *update_task; |
115 | 114 | ||
116 | /** | 115 | /** |
117 | * Timeout for next update pass | 116 | * Timeout for next update pass |
@@ -494,9 +493,11 @@ handle_token_update (void *cls) | |||
494 | scopes = NULL; | 493 | scopes = NULL; |
495 | } | 494 | } |
496 | 495 | ||
496 | |||
497 | static void | 497 | static void |
498 | update_identities(void *cls); | 498 | update_identities(void *cls); |
499 | 499 | ||
500 | |||
500 | /** | 501 | /** |
501 | * | 502 | * |
502 | * Cleanup attr_map | 503 | * Cleanup attr_map |
@@ -504,7 +505,7 @@ update_identities(void *cls); | |||
504 | * @param cls NULL | 505 | * @param cls NULL |
505 | * @param key the key | 506 | * @param key the key |
506 | * @param value the json_t attribute value | 507 | * @param value the json_t attribute value |
507 | * @return GNUNET_YES | 508 | * @return #GNUNET_YES |
508 | */ | 509 | */ |
509 | static int | 510 | static int |
510 | clear_ego_attrs (void *cls, | 511 | clear_ego_attrs (void *cls, |
@@ -530,6 +531,7 @@ clear_ego_attrs (void *cls, | |||
530 | return GNUNET_YES; | 531 | return GNUNET_YES; |
531 | } | 532 | } |
532 | 533 | ||
534 | |||
533 | /** | 535 | /** |
534 | * | 536 | * |
535 | * Update all ID_TOKEN records for an identity and store them | 537 | * Update all ID_TOKEN records for an identity and store them |
@@ -539,7 +541,6 @@ clear_ego_attrs (void *cls, | |||
539 | * @param lbl the name of the record | 541 | * @param lbl the name of the record |
540 | * @param rd_count number of records | 542 | * @param rd_count number of records |
541 | * @param rd record data | 543 | * @param rd record data |
542 | * | ||
543 | */ | 544 | */ |
544 | static void | 545 | static void |
545 | token_collect (void *cls, | 546 | token_collect (void *cls, |
@@ -579,7 +580,9 @@ token_collect (void *cls, | |||
579 | { | 580 | { |
580 | token_metadata_record = &rd[0]; | 581 | token_metadata_record = &rd[0]; |
581 | token_record = &rd[1]; | 582 | token_record = &rd[1]; |
582 | } else { | 583 | } |
584 | else | ||
585 | { | ||
583 | token_record = &rd[0]; | 586 | token_record = &rd[0]; |
584 | token_metadata_record = &rd[1]; | 587 | token_metadata_record = &rd[1]; |
585 | } | 588 | } |
@@ -607,7 +610,8 @@ token_collect (void *cls, | |||
607 | label = GNUNET_strdup (lbl); | 610 | label = GNUNET_strdup (lbl); |
608 | rd_exp = token_record->expiration_time; | 611 | rd_exp = token_record->expiration_time; |
609 | 612 | ||
610 | GNUNET_SCHEDULER_add_now (&handle_token_update, ego_entry); | 613 | GNUNET_SCHEDULER_add_now (&handle_token_update, |
614 | ego_entry); | ||
611 | } | 615 | } |
612 | 616 | ||
613 | 617 | ||
@@ -642,7 +646,8 @@ attribute_collect (void *cls, | |||
642 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 646 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
643 | ">>> Updating Attributes finished\n"); | 647 | ">>> Updating Attributes finished\n"); |
644 | ego_entry->attributes_dirty = GNUNET_NO; | 648 | ego_entry->attributes_dirty = GNUNET_NO; |
645 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, ego_entry); | 649 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, |
650 | ego_entry); | ||
646 | return; | 651 | return; |
647 | } | 652 | } |
648 | 653 | ||
@@ -752,7 +757,6 @@ update_identities(void *cls) | |||
752 | } | 757 | } |
753 | 758 | ||
754 | 759 | ||
755 | |||
756 | /** | 760 | /** |
757 | * Function called initially to start update task | 761 | * Function called initially to start update task |
758 | */ | 762 | */ |
@@ -761,9 +765,11 @@ init_cont () | |||
761 | { | 765 | { |
762 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, ">>> Starting Service\n"); | 766 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, ">>> Starting Service\n"); |
763 | //Initially iterate all itenties and refresh all tokens | 767 | //Initially iterate all itenties and refresh all tokens |
764 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, ego_head); | 768 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, |
769 | ego_head); | ||
765 | } | 770 | } |
766 | 771 | ||
772 | |||
767 | /** | 773 | /** |
768 | * Initial ego collection function. | 774 | * Initial ego collection function. |
769 | * | 775 | * |
@@ -934,6 +940,7 @@ store_token_issue_cont (void *cls, | |||
934 | struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage *irm; | 940 | struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage *irm; |
935 | char *ticket_str; | 941 | char *ticket_str; |
936 | char *token_str; | 942 | char *token_str; |
943 | |||
937 | handle->ns_qe = NULL; | 944 | handle->ns_qe = NULL; |
938 | if (GNUNET_SYSERR == success) | 945 | if (GNUNET_SYSERR == success) |
939 | { | 946 | { |
@@ -964,7 +971,9 @@ store_token_issue_cont (void *cls, | |||
964 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 971 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
965 | return; | 972 | return; |
966 | } | 973 | } |
967 | irm = create_issue_result_message (handle->label, ticket_str, token_str); | 974 | irm = create_issue_result_message (handle->label, |
975 | ticket_str, | ||
976 | token_str); | ||
968 | GNUNET_SERVER_notification_context_unicast (nc, | 977 | GNUNET_SERVER_notification_context_unicast (nc, |
969 | handle->client, | 978 | handle->client, |
970 | &irm->header, | 979 | &irm->header, |
@@ -1528,19 +1537,16 @@ run (void *cls, | |||
1528 | token_expiration_interval = DEFAULT_TOKEN_EXPIRATION_INTERVAL; | 1537 | token_expiration_interval = DEFAULT_TOKEN_EXPIRATION_INTERVAL; |
1529 | } | 1538 | } |
1530 | 1539 | ||
1531 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 1540 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); |
1532 | &do_shutdown, NULL); | ||
1533 | } | 1541 | } |
1534 | 1542 | ||
1535 | 1543 | ||
1536 | /** | 1544 | /** |
1537 | * | ||
1538 | * The main function | 1545 | * The main function |
1539 | * | 1546 | * |
1540 | * @param argc number of arguments from the cli | 1547 | * @param argc number of arguments from the cli |
1541 | * @param argv command line arguments | 1548 | * @param argv command line arguments |
1542 | * @return 0 ok, 1 on error | 1549 | * @return 0 ok, 1 on error |
1543 | * | ||
1544 | */ | 1550 | */ |
1545 | int | 1551 | int |
1546 | main (int argc, char *const *argv) | 1552 | main (int argc, char *const *argv) |
@@ -1551,4 +1557,4 @@ main (int argc, char *const *argv) | |||
1551 | &run, NULL)) ? 0 : 1; | 1557 | &run, NULL)) ? 0 : 1; |
1552 | } | 1558 | } |
1553 | 1559 | ||
1554 | /* end of gnunet-rest-server.c */ | 1560 | /* end of gnunet-service-identity-provider.c */ |