aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-04-21 20:19:43 +0000
committerChristian Grothoff <christian@grothoff.org>2010-04-21 20:19:43 +0000
commit84e15afe4933ee2ca62e3e111ca261c3a986c157 (patch)
tree8a9cd9a06b723b940f6d11b0272f5eb395db39c4 /src/core
parenta06d7742d5a48229767c152f9466432d17e162de (diff)
downloadgnunet-84e15afe4933ee2ca62e3e111ca261c3a986c157.tar.gz
gnunet-84e15afe4933ee2ca62e3e111ca261c3a986c157.zip
activating new peerinfo API
Diffstat (limited to 'src/core')
-rw-r--r--src/core/gnunet-service-core.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index bad6f05d3..aa4d4afb1 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -656,6 +656,11 @@ static struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key;
656struct GNUNET_SCHEDULER_Handle *sched; 656struct GNUNET_SCHEDULER_Handle *sched;
657 657
658/** 658/**
659 * Handle to peerinfo service.
660 */
661static struct GNUNET_PEERINFO_Handle *peerinfo;
662
663/**
659 * Our configuration. 664 * Our configuration.
660 */ 665 */
661const struct GNUNET_CONFIGURATION_Handle *cfg; 666const struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -2491,8 +2496,7 @@ send_key (struct Neighbour *n)
2491 GNUNET_i2s (&n->peer)); 2496 GNUNET_i2s (&n->peer));
2492#endif 2497#endif
2493 GNUNET_assert (n->pitr == NULL); 2498 GNUNET_assert (n->pitr == NULL);
2494 n->pitr = GNUNET_PEERINFO_iterate (cfg, 2499 n->pitr = GNUNET_PEERINFO_iterate (peerinfo,
2495 sched,
2496 &n->peer, 2500 &n->peer,
2497 0, 2501 0,
2498 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 20), 2502 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 20),
@@ -2923,8 +2927,7 @@ handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m)
2923 /* lookup n's public key, then try again */ 2927 /* lookup n's public key, then try again */
2924 GNUNET_assert (n->skm == NULL); 2928 GNUNET_assert (n->skm == NULL);
2925 n->skm = m_cpy; 2929 n->skm = m_cpy;
2926 n->pitr = GNUNET_PEERINFO_iterate (cfg, 2930 n->pitr = GNUNET_PEERINFO_iterate (peerinfo,
2927 sched,
2928 &n->peer, 2931 &n->peer,
2929 0, 2932 0,
2930 GNUNET_TIME_UNIT_MINUTES, 2933 GNUNET_TIME_UNIT_MINUTES,
@@ -3737,6 +3740,8 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3737 GNUNET_CRYPTO_rsa_key_free (my_private_key); 3740 GNUNET_CRYPTO_rsa_key_free (my_private_key);
3738 if (stats != NULL) 3741 if (stats != NULL)
3739 GNUNET_STATISTICS_destroy (stats, GNUNET_NO); 3742 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
3743 if (peerinfo != NULL)
3744 GNUNET_PEERINFO_disconnect (peerinfo);
3740} 3745}
3741 3746
3742 3747
@@ -3781,12 +3786,21 @@ run (void *cls,
3781 GNUNET_SCHEDULER_shutdown (s); 3786 GNUNET_SCHEDULER_shutdown (s);
3782 return; 3787 return;
3783 } 3788 }
3789 peerinfo = GNUNET_PEERINFO_connect (sched, cfg);
3790 if (NULL == peerinfo)
3791 {
3792 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3793 _("Could not access PEERINFO service. Exiting.\n"));
3794 GNUNET_SCHEDULER_shutdown (s);
3795 return;
3796 }
3784 my_private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); 3797 my_private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
3785 GNUNET_free (keyfile); 3798 GNUNET_free (keyfile);
3786 if (my_private_key == NULL) 3799 if (my_private_key == NULL)
3787 { 3800 {
3788 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 3801 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3789 _("Core service could not access hostkey. Exiting.\n")); 3802 _("Core service could not access hostkey. Exiting.\n"));
3803 GNUNET_PEERINFO_disconnect (peerinfo);
3790 GNUNET_SCHEDULER_shutdown (s); 3804 GNUNET_SCHEDULER_shutdown (s);
3791 return; 3805 return;
3792 } 3806 }