else
{
(*stop) = GNUNET_YES;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "NULL \n");
}
}
*
* @param cls closure
* @param client identification of the client
+ * @param message the stop message
*/
static void handle_stop (void *cls,
struct GNUNET_SERVER_Client * client,
while (stop == GNUNET_NO)
{
GSN_database->iterate_records (GSN_database->cls, NULL, NULL, offset, &drop_iterator, &stop);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "STOP %u \n");
offset ++;
}
}
size_t rd_ser_len;
struct GNUNET_CRYPTO_RsaSignature *signature_tmp;
-
-
size_t r_size = 0;
size_t name_len = 0;
for (c = 0; c < rd_count; c ++)
if (rd[c].record_type == lnc->record_type)
copied_elements++; /* found matching record */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records with type %u for name `%s' in zone `%s'\n",
+ copied_elements, lnc->record_type, lnc->name, GNUNET_h2s(lnc->zone));
rd_selected = GNUNET_malloc (copied_elements * sizeof (struct GNUNET_NAMESTORE_RecordData));
copied_elements = 0;
for (c = 0; c < rd_count; c ++)
expire = GNUNET_TIME_UNIT_ZERO_ABS;
}
-
-
rd_ser_len = GNUNET_NAMESTORE_records_get_size(copied_elements, rd_selected);
char rd_ser[rd_ser_len];
GNUNET_NAMESTORE_records_serialize(copied_elements, rd_selected, rd_ser_len, rd_ser);
lnr_msg->gns_header.header.type = ntohs (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE);
lnr_msg->gns_header.header.size = ntohs (r_size);
lnr_msg->gns_header.r_id = htonl (lnc->request_id);
- lnr_msg->rd_count = htons (rd_count);
+ lnr_msg->rd_count = htons (copied_elements);
lnr_msg->rd_len = htons (rd_ser_len);
lnr_msg->name_len = htons (name_len);
lnr_msg->expire = GNUNET_TIME_absolute_hton(expire);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up record for name `%s' in zone `%s'\n", name, GNUNET_h2s(&ln_msg->zone));
-
+ if (0 == type)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up all records for name `%s' in zone `%s'\n", name, GNUNET_h2s(&ln_msg->zone));
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up records with type %u for name `%s' in zone `%s'\n", type, name, GNUNET_h2s(&ln_msg->zone));
/* do the actual lookup */
lnc.request_id = rid;
lnc.nc = nc;
(crc->rd->data_size == rd[c].data_size) &&
(0 == memcmp (crc->rd->data, rd[c].data, rd[c].data_size)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found existing records for `%s' to update!\n", crc->name);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found existing records for `%s' to update expiration date!\n", crc->name);
exist = c;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "exp %llu %llu!\n", rd[c].expiration.abs_value, crc->rd->expiration.abs_value);
if (crc->rd->expiration.abs_value != rd[c].expiration.abs_value)
-
update = GNUNET_YES;
break;
}
rd_new = GNUNET_malloc ((rd_count) * sizeof (struct GNUNET_NAMESTORE_RecordData));
memcpy (rd_new, rd, rd_count * sizeof (struct GNUNET_NAMESTORE_RecordData));
rd_count_new = rd_count;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating expiration from %llu to %llu!\n", rd_new[exist].expiration.abs_value, crc->rd->expiration.abs_value);
rd_new[exist].expiration = crc->rd->expiration;
signature_new = GNUNET_NAMESTORE_create_signature (crc->pkey, crc->name, rd_new, rd_count_new);
if (NULL == signature_new)
GNUNET_free_non_null (rd_new);
GNUNET_free_non_null (signature_new);
+ switch (res) {
+ case GNUNET_SYSERR:
+ /* failed to create the record */
+ crc->res = GNUNET_SYSERR;
+ break;
+ case GNUNET_YES:
+ /* database operations OK */
+ if (GNUNET_YES == update)
+ /* we updated an existing record */
+ crc->res = GNUNET_NO;
+ else
+ /* we created a new record */
+ crc->res = GNUNET_YES;
+ break;
+ case GNUNET_NO:
+ /* identical entry existed, so we did nothing */
+ crc->res = GNUNET_NO;
+ break;
+ default:
+ break;
+ }
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Update result for name `%s' %u\n", crc->name, res);
- crc->res = res;
+
}
static void handle_record_create (void *cls,