struct GNUNET_NAMESTORE_Client * client;
+ int has_zone;
+
GNUNET_HashCode zone;
uint64_t request_id;
uint32_t offset;
+
+
};
GNUNET_free (no);
}
+
GNUNET_SERVER_client_drop(nc->client);
GNUNET_CONTAINER_DLL_remove (client_head, client_tail, nc);
GNUNET_free (nc);
struct CreateRecordContext * crc = cls;
struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL;
struct GNUNET_NAMESTORE_RecordData *rd_new = NULL;
+ struct GNUNET_TIME_Absolute block_expiration;
int res;
int exist = GNUNET_SYSERR;
int update = GNUNET_NO;
}
}
+ block_expiration = GNUNET_TIME_absolute_max(crc->expire, expire);
+ if (block_expiration.abs_value != expire.abs_value)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updated block expiration time\n");
+
+
/* Database operation */
GNUNET_assert ((rd_new != NULL) && (rd_count_new > 0));
res = GSN_database->put_records(GSN_database->cls,
(const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *) crc->pubkey,
- crc->expire,
+ block_expiration,
crc->name,
rd_count_new, rd_new,
signature_new);
}
struct GNUNET_NAMESTORE_RecordData rd[rd_count];
+
res = GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_ser, rd_count, rd);
if ((res != GNUNET_OK) || (rd_count != 1))
{
GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub);
GNUNET_CRYPTO_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+ crc.expire = GNUNET_TIME_absolute_ntoh(rp_msg->expire);
+ crc.res = GNUNET_SYSERR;
crc.pkey = pkey;
crc.pubkey = &pub;
crc.rd = rd;
if ((zone_key == NULL) && (name == NULL))
{
struct ZoneIterationResponseMessage zir_msg;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for zone `%s'\n", GNUNET_h2s(&zi->zone));
+ if (zi->has_zone == GNUNET_YES)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for zone `%s'\n", GNUNET_h2s(&zi->zone));
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for all zones\n");
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending empty `%s' message\n", "ZONE_ITERATION_RESPONSE");
zir_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE);
zir_msg.gns_header.header.size = htons (sizeof (struct ZoneIterationResponseMessage));
else
{
struct ZoneIterationResponseMessage *zir_msg;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iterating zone `%s'\n", name, GNUNET_h2s(&zi->zone));
+ if (zi->has_zone == GNUNET_YES)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration over zone `%s'\n",
+ name, GNUNET_h2s(&zi->zone));
+ if (zi->has_zone == GNUNET_NO)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration over all zones\n",
+ name);
+
size_t name_len;
size_t rd_ser_len;
size_t msg_size;
if (0 == memcmp (&dummy, &zis_msg->zone, sizeof (dummy)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to iterate over all zones\n");
+ zi->has_zone = GNUNET_NO;
zone_tmp = NULL;
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to iterate over zone `%s'\n", GNUNET_h2s (&zis_msg->zone));
+ zi->has_zone = GNUNET_YES;
zone_tmp = &zis_msg->zone;
}
GNUNET_CONTAINER_DLL_insert (nc->op_head, nc->op_tail, zi);
-
res = GSN_database->iterate_records (GSN_database->cls, zone_tmp , NULL, zi->offset , &zone_iteration_proc, zi);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
}
GNUNET_CONTAINER_DLL_remove(nc->op_head, nc->op_tail, zi);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration for zone `%s'\n", GNUNET_h2s (&zi->zone));
+ if (GNUNET_YES == zi->has_zone)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration for zone `%s'\n", GNUNET_h2s (&zi->zone));
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration all zones\n");
GNUNET_free (zi);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
struct GNUNET_NAMESTORE_Client *nc;
struct GNUNET_NAMESTORE_ZoneIteration *zi;
+ GNUNET_HashCode *zone_tmp;
struct ZoneIterationStopMessage * zis_msg = (struct ZoneIterationStopMessage *) message;
uint32_t rid;
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
- zi->offset++;
- GSN_database->iterate_records (GSN_database->cls, &zi->zone, NULL, zi->offset , &zone_iteration_proc, zi);
+ if (GNUNET_YES == zi->has_zone)
+ zone_tmp = &zi->zone;
+ else
+ zone_tmp = NULL;
+
+ zi->offset++;
+ GSN_database->iterate_records (GSN_database->cls, zone_tmp, NULL, zi->offset , &zone_iteration_proc, zi);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}