aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/gnunet-service-namestore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r--src/namestore/gnunet-service-namestore.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index c92f39a59..67c7e6e57 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -170,6 +170,7 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client)
170 GNUNET_free (no); 170 GNUNET_free (no);
171 } 171 }
172 172
173
173 GNUNET_SERVER_client_drop(nc->client); 174 GNUNET_SERVER_client_drop(nc->client);
174 GNUNET_CONTAINER_DLL_remove (client_head, client_tail, nc); 175 GNUNET_CONTAINER_DLL_remove (client_head, client_tail, nc);
175 GNUNET_free (nc); 176 GNUNET_free (nc);
@@ -543,6 +544,7 @@ handle_create_record_it (void *cls,
543 struct CreateRecordContext * crc = cls; 544 struct CreateRecordContext * crc = cls;
544 struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL; 545 struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL;
545 struct GNUNET_NAMESTORE_RecordData *rd_new = NULL; 546 struct GNUNET_NAMESTORE_RecordData *rd_new = NULL;
547 struct GNUNET_TIME_Absolute block_expiration;
546 int res; 548 int res;
547 int exist = GNUNET_SYSERR; 549 int exist = GNUNET_SYSERR;
548 int update = GNUNET_NO; 550 int update = GNUNET_NO;
@@ -609,11 +611,16 @@ handle_create_record_it (void *cls,
609 } 611 }
610 } 612 }
611 613
614 block_expiration = GNUNET_TIME_absolute_max(crc->expire, expire);
615 if (block_expiration.abs_value != expire.abs_value)
616 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updated block expiration time\n");
617
618
612 /* Database operation */ 619 /* Database operation */
613 GNUNET_assert ((rd_new != NULL) && (rd_count_new > 0)); 620 GNUNET_assert ((rd_new != NULL) && (rd_count_new > 0));
614 res = GSN_database->put_records(GSN_database->cls, 621 res = GSN_database->put_records(GSN_database->cls,
615 (const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *) crc->pubkey, 622 (const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *) crc->pubkey,
616 crc->expire, 623 block_expiration,
617 crc->name, 624 crc->name,
618 rd_count_new, rd_new, 625 rd_count_new, rd_new,
619 signature_new); 626 signature_new);
@@ -729,6 +736,7 @@ static void handle_record_create (void *cls,
729 } 736 }
730 737
731 struct GNUNET_NAMESTORE_RecordData rd[rd_count]; 738 struct GNUNET_NAMESTORE_RecordData rd[rd_count];
739
732 res = GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_ser, rd_count, rd); 740 res = GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_ser, rd_count, rd);
733 if ((res != GNUNET_OK) || (rd_count != 1)) 741 if ((res != GNUNET_OK) || (rd_count != 1))
734 { 742 {
@@ -742,6 +750,8 @@ static void handle_record_create (void *cls,
742 GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub); 750 GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub);
743 GNUNET_CRYPTO_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash); 751 GNUNET_CRYPTO_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
744 752
753 crc.expire = GNUNET_TIME_absolute_ntoh(rp_msg->expire);
754 crc.res = GNUNET_SYSERR;
745 crc.pkey = pkey; 755 crc.pkey = pkey;
746 crc.pubkey = &pub; 756 crc.pubkey = &pub;
747 crc.rd = rd; 757 crc.rd = rd;
@@ -1289,7 +1299,6 @@ static void handle_iteration_start (void *cls,
1289 1299
1290 GNUNET_CONTAINER_DLL_insert (nc->op_head, nc->op_tail, zi); 1300 GNUNET_CONTAINER_DLL_insert (nc->op_head, nc->op_tail, zi);
1291 1301
1292
1293 res = GSN_database->iterate_records (GSN_database->cls, zone_tmp , NULL, zi->offset , &zone_iteration_proc, zi); 1302 res = GSN_database->iterate_records (GSN_database->cls, zone_tmp , NULL, zi->offset , &zone_iteration_proc, zi);
1294 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1303 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1295} 1304}