aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/gnunet-service-datastore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datastore/gnunet-service-datastore.c')
-rw-r--r--src/datastore/gnunet-service-datastore.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index deab62dd0..a0d5f7bab 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -646,16 +646,20 @@ transmit_item (void *cls,
646 dm->type = htonl(type); 646 dm->type = htonl(type);
647 dm->priority = htonl(priority); 647 dm->priority = htonl(priority);
648 dm->anonymity = htonl(anonymity); 648 dm->anonymity = htonl(anonymity);
649 dm->replication = htonl (0);
650 dm->reserved = htonl (0);
649 dm->expiration = GNUNET_TIME_absolute_hton(expiration); 651 dm->expiration = GNUNET_TIME_absolute_hton(expiration);
650 dm->uid = GNUNET_htonll(uid); 652 dm->uid = GNUNET_htonll(uid);
651 dm->key = *key; 653 dm->key = *key;
652 memcpy (&dm[1], data, size); 654 memcpy (&dm[1], data, size);
653#if DEBUG_DATASTORE 655#if DEBUG_DATASTORE
654 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 656 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
655 "Transmitting `%s' message for `%s' of type %u\n", 657 "Transmitting `%s' message for `%s' of type %u with expiration %llu (now: %llu)\n",
656 "DATA", 658 "DATA",
657 GNUNET_h2s (key), 659 GNUNET_h2s (key),
658 type); 660 type,
661 (unsigned long long) expiration.abs_value,
662 (unsigned long long) GNUNET_TIME_absolute_get ().abs_value);
659#endif 663#endif
660 GNUNET_STATISTICS_update (stats, 664 GNUNET_STATISTICS_update (stats,
661 gettext_noop ("# results found"), 665 gettext_noop ("# results found"),
@@ -870,7 +874,7 @@ execute_put (struct GNUNET_SERVER_Client *client,
870 ntohl(dm->type), 874 ntohl(dm->type),
871 ntohl(dm->priority), 875 ntohl(dm->priority),
872 ntohl(dm->anonymity), 876 ntohl(dm->anonymity),
873 0 /* FIXME: replication */, 877 ntohl(dm->replication),
874 GNUNET_TIME_absolute_ntoh(dm->expiration), 878 GNUNET_TIME_absolute_ntoh(dm->expiration),
875 &msg); 879 &msg);
876 if (GNUNET_OK == ret) 880 if (GNUNET_OK == ret)
@@ -956,6 +960,15 @@ check_present (void *cls,
956 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 960 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
957 "Result already present in datastore\n"); 961 "Result already present in datastore\n");
958#endif 962#endif
963 /* FIXME: change API to allow increasing 'replication' counter */
964 if ( (ntohl (dm->priority) > 0) ||
965 (GNUNET_TIME_absolute_ntoh(dm->expiration).abs_value >
966 expiration.abs_value) )
967 plugin->api->update (plugin->api->cls,
968 uid,
969 (int32_t) ntohl(dm->priority),
970 GNUNET_TIME_absolute_ntoh(dm->expiration),
971 NULL);
959 transmit_status (pc->client, GNUNET_NO, NULL); 972 transmit_status (pc->client, GNUNET_NO, NULL);
960 GNUNET_SERVER_client_drop (pc->client); 973 GNUNET_SERVER_client_drop (pc->client);
961 GNUNET_free (pc); 974 GNUNET_free (pc);