- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Sub system not supplied in client iterate request\n");
- GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
- return;
+ GNUNET_break (0);
+ PEERSTORE_destroy_record (record);
+ return GNUNET_SYSERR;
+ }
+ PEERSTORE_destroy_record (record);
+ return GNUNET_OK;
+}
+
+
+/**
+ * Handle an iterate request from client
+ *
+ * @param cls identification of the client
+ * @param srm the actual message
+ */
+static void
+handle_iterate (void *cls,
+ const struct StoreRecordMessage *srm)
+{
+ struct GNUNET_SERVICE_Client *client = cls;
+ struct GNUNET_PEERSTORE_Record *record;
+
+ record = PEERSTORE_parse_record_message (srm);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Iterate request: ss `%s', peer `%s', key `%s'\n",
+ record->sub_system,
+ GNUNET_i2s (&record->peer),
+ (NULL == record->key) ? "NULL" : record->key);
+ record->client = client;
+ if (GNUNET_OK !=
+ db->iterate_records (db->cls,
+ record->sub_system,
+ (ntohs (srm->peer_set)) ? &record->peer : NULL,
+ record->key,
+ &record_iterator,
+ record))
+ {
+ GNUNET_break (0);
+ GNUNET_SERVICE_client_drop (client);
+ PEERSTORE_destroy_record (record);