aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_zone_iteration.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-02-28 10:18:27 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-02-28 10:18:27 +0000
commit2f5b9e1354967db31504cfcf2281e546aedaa248 (patch)
treea987971f8b9c28dc61e6bcae4d8a073d46f47a9b /src/namestore/test_namestore_api_zone_iteration.c
parentb5ae0f488ef287e9d65f3a866cba671f9a6be842 (diff)
downloadgnunet-2f5b9e1354967db31504cfcf2281e546aedaa248.tar.gz
gnunet-2f5b9e1354967db31504cfcf2281e546aedaa248.zip
- more zone iteration
Diffstat (limited to 'src/namestore/test_namestore_api_zone_iteration.c')
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index a53a2febc..c0ef8c809 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -32,6 +32,7 @@
32static struct GNUNET_NAMESTORE_Handle * nsh; 32static struct GNUNET_NAMESTORE_Handle * nsh;
33 33
34static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; 34static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
35static GNUNET_SCHEDULER_TaskIdentifier stopiteration_task;
35static struct GNUNET_OS_Process *arm; 36static struct GNUNET_OS_Process *arm;
36 37
37static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; 38static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
@@ -76,6 +77,12 @@ stop_arm ()
76static void 77static void
77endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 78endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
78{ 79{
80 if (stopiteration_task != GNUNET_SCHEDULER_NO_TASK)
81 {
82 GNUNET_SCHEDULER_cancel (stopiteration_task);
83 stopiteration_task = GNUNET_SCHEDULER_NO_TASK;
84 }
85
79 if (nsh != NULL) 86 if (nsh != NULL)
80 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES); 87 GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES);
81 nsh = NULL; 88 nsh = NULL;
@@ -94,12 +101,19 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
94static void 101static void
95end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 102end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
96{ 103{
104 if (stopiteration_task != GNUNET_SCHEDULER_NO_TASK)
105 {
106 GNUNET_SCHEDULER_cancel (stopiteration_task);
107 stopiteration_task = GNUNET_SCHEDULER_NO_TASK;
108 }
109
97 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 110 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
98 { 111 {
99 GNUNET_SCHEDULER_cancel (endbadly_task); 112 GNUNET_SCHEDULER_cancel (endbadly_task);
100 endbadly_task = GNUNET_SCHEDULER_NO_TASK; 113 endbadly_task = GNUNET_SCHEDULER_NO_TASK;
101 } 114 }
102 115
116
103 if (privkey != NULL) 117 if (privkey != NULL)
104 GNUNET_CRYPTO_rsa_key_free (privkey); 118 GNUNET_CRYPTO_rsa_key_free (privkey);
105 privkey = NULL; 119 privkey = NULL;
@@ -115,6 +129,16 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
115 res = 0; 129 res = 0;
116} 130}
117 131
132static void
133stop_iteration (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
134{
135 stopiteration_task = GNUNET_SCHEDULER_NO_TASK;
136
137 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping iteration for zone `%s'\n", GNUNET_h2s (&zone));
138 GNUNET_NAMESTORE_zone_iteration_stop (zi);
139
140 GNUNET_SCHEDULER_add_now (&end, NULL);
141}
118 142
119void zone_proc (void *cls, 143void zone_proc (void *cls,
120 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 144 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
@@ -125,7 +149,8 @@ void zone_proc (void *cls,
125 const struct GNUNET_CRYPTO_RsaSignature *signature) 149 const struct GNUNET_CRYPTO_RsaSignature *signature)
126{ 150{
127 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", GNUNET_h2s (&zone)); 151 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", GNUNET_h2s (&zone));
128 endbadly_task = GNUNET_SCHEDULER_add_now (&end, NULL); 152
153 stopiteration_task = GNUNET_SCHEDULER_add_now (&stop_iteration, NULL);
129} 154}
130 155
131static void 156static void