diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-02-28 10:18:27 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-02-28 10:18:27 +0000 |
commit | 2f5b9e1354967db31504cfcf2281e546aedaa248 (patch) | |
tree | a987971f8b9c28dc61e6bcae4d8a073d46f47a9b /src/namestore/test_namestore_api_zone_iteration.c | |
parent | b5ae0f488ef287e9d65f3a866cba671f9a6be842 (diff) | |
download | gnunet-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.c | 27 |
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 @@ | |||
32 | static struct GNUNET_NAMESTORE_Handle * nsh; | 32 | static struct GNUNET_NAMESTORE_Handle * nsh; |
33 | 33 | ||
34 | static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; | 34 | static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; |
35 | static GNUNET_SCHEDULER_TaskIdentifier stopiteration_task; | ||
35 | static struct GNUNET_OS_Process *arm; | 36 | static struct GNUNET_OS_Process *arm; |
36 | 37 | ||
37 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 38 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; |
@@ -76,6 +77,12 @@ stop_arm () | |||
76 | static void | 77 | static void |
77 | endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 78 | endbadly (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) | |||
94 | static void | 101 | static void |
95 | end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 102 | end (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 | ||
132 | static void | ||
133 | stop_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 | ||
119 | void zone_proc (void *cls, | 143 | void 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 | ||
131 | static void | 156 | static void |