diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-01 16:54:02 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-01 16:54:02 +0000 |
commit | 3862df84d4e39ab20330223186544e2193cbeee6 (patch) | |
tree | b71bd582bda82ad59423227d4fc2548ed94e8267 /src/namestore/test_namestore_api_remove_not_existing_record.c | |
parent | 8d3546bdb0e458da96092f76dc4d2735c747335d (diff) | |
download | gnunet-3862df84d4e39ab20330223186544e2193cbeee6.tar.gz gnunet-3862df84d4e39ab20330223186544e2193cbeee6.zip |
- more changes
Diffstat (limited to 'src/namestore/test_namestore_api_remove_not_existing_record.c')
-rw-r--r-- | src/namestore/test_namestore_api_remove_not_existing_record.c | 68 |
1 files changed, 3 insertions, 65 deletions
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index b202c9357..8e71159fb 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c | |||
@@ -132,83 +132,21 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
132 | stop_arm(); | 132 | stop_arm(); |
133 | } | 133 | } |
134 | 134 | ||
135 | void name_lookup_proc (void *cls, | ||
136 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | ||
137 | struct GNUNET_TIME_Absolute expire, | ||
138 | const char *n, | ||
139 | unsigned int rd_count, | ||
140 | const struct GNUNET_NAMESTORE_RecordData *rd, | ||
141 | const struct GNUNET_CRYPTO_RsaSignature *signature) | ||
142 | { | ||
143 | static int found = GNUNET_NO; | ||
144 | int failed = GNUNET_NO; | ||
145 | int c; | ||
146 | |||
147 | if (n != NULL) | ||
148 | { | ||
149 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Lookup for name `%s' returned %u records\n", n, rd_count); | ||
150 | if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))) | ||
151 | { | ||
152 | GNUNET_break (0); | ||
153 | failed = GNUNET_YES; | ||
154 | } | ||
155 | |||
156 | if (0 != strcmp(n, s_name)) | ||
157 | { | ||
158 | GNUNET_break (0); | ||
159 | failed = GNUNET_YES; | ||
160 | } | ||
161 | |||
162 | if (RECORDS-1 != rd_count) | ||
163 | { | ||
164 | GNUNET_break (0); | ||
165 | failed = GNUNET_YES; | ||
166 | } | ||
167 | |||
168 | for (c = 0; c < rd_count; c++) | ||
169 | { | ||
170 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Record [%u]: type: %u, size %u\n", c, rd[c].record_type, rd[c].data_size); | ||
171 | GNUNET_break (rd[c].expiration.abs_value == s_rd[c+1].expiration.abs_value); | ||
172 | GNUNET_break (rd[c].record_type == TEST_RECORD_TYPE); | ||
173 | GNUNET_break (rd[c].data_size == TEST_RECORD_DATALEN); | ||
174 | GNUNET_break (0 == memcmp (rd[c].data, s_rd[c+1].data, TEST_RECORD_DATALEN)); | ||
175 | } | ||
176 | |||
177 | found = GNUNET_YES; | ||
178 | if (failed == GNUNET_NO) | ||
179 | res = 0; | ||
180 | else | ||
181 | res = 1; | ||
182 | } | ||
183 | else | ||
184 | { | ||
185 | if (found != GNUNET_YES) | ||
186 | { | ||
187 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to lookup records for name `%s'\n", s_name); | ||
188 | res = 1; | ||
189 | } | ||
190 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Lookup done for name %s'\n", s_name); | ||
191 | } | ||
192 | GNUNET_SCHEDULER_add_now(&end, NULL); | ||
193 | } | ||
194 | |||
195 | void | 135 | void |
196 | remove_cont (void *cls, int32_t success, const char *emsg) | 136 | remove_cont (void *cls, int32_t success, const char *emsg) |
197 | { | 137 | { |
198 | char *name = cls; | 138 | char *name = cls; |
199 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Remove record for `%s': %s `%s'\n", name, (success == GNUNET_YES) ? "SUCCESS" : "FAIL", emsg); | 139 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Remove record for `%s': %s `%s'\n", name, (success == GNUNET_YES) ? "SUCCESS" : "FAIL", emsg); |
200 | if (success == GNUNET_OK) | 140 | if (GNUNET_NO == success) |
201 | { | 141 | { |
202 | res = 0; | 142 | res = 0; |
203 | GNUNET_NAMESTORE_lookup_record (nsh, &s_zone, name, 0, &name_lookup_proc, name); | ||
204 | } | 143 | } |
205 | else | 144 | else |
206 | { | 145 | { |
207 | res = 1; | 146 | res = 1; |
208 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to put records for name `%s'\n", name); | 147 | GNUNET_break (0); |
209 | GNUNET_SCHEDULER_add_now(&end, NULL); | ||
210 | } | 148 | } |
211 | 149 | GNUNET_SCHEDULER_add_now(&end, NULL); | |
212 | } | 150 | } |
213 | 151 | ||
214 | void | 152 | void |