gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16341 - gnunet/src/datastore


From: gnunet
Subject: [GNUnet-SVN] r16341 - gnunet/src/datastore
Date: Tue, 2 Aug 2011 23:35:09 +0200

Author: grothoff
Date: 2011-08-02 23:35:09 +0200 (Tue, 02 Aug 2011)
New Revision: 16341

Modified:
   gnunet/src/datastore/plugin_datastore_postgres.c
Log:
use postgres PRNG also on insertion

Modified: gnunet/src/datastore/plugin_datastore_postgres.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_postgres.c    2011-08-02 21:33:25 UTC 
(rev 16340)
+++ gnunet/src/datastore/plugin_datastore_postgres.c    2011-08-02 21:35:09 UTC 
(rev 16341)
@@ -311,7 +311,7 @@
        pq_prepare (plugin,
                   "put",
                    "INSERT INTO gn090 (repl, type, prio, anonLevel, expire, 
rvalue, hash, vhash, value) "
-                   "VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
+                   "VALUES ($1, $2, $3, $4, $5, RANDOM(), $6, $7, $8)",
                    9,
                    __LINE__)) ||
       (GNUNET_OK !=
@@ -477,14 +477,12 @@
   uint32_t banon = htonl (anonymity);
   uint32_t brepl = htonl (replication);
   uint64_t bexpi = GNUNET_TIME_absolute_hton (expiration).abs_value__;
-  uint64_t rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, 
UINT64_MAX);
   const char *paramValues[] = {
     (const char *) &brepl,
     (const char *) &btype,
     (const char *) &bprio,
     (const char *) &banon,
     (const char *) &bexpi,
-    (const char *) &rvalue,
     (const char *) key,
     (const char *) &vhash,
     (const char *) data
@@ -495,16 +493,15 @@
     sizeof (bprio),
     sizeof (banon),
     sizeof (bexpi),
-    sizeof (rvalue),
     sizeof (GNUNET_HashCode),
     sizeof (GNUNET_HashCode),
     size
   };
-  const int paramFormats[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 };
+  const int paramFormats[] = { 1, 1, 1, 1, 1, 1, 1, 1 };
 
   GNUNET_CRYPTO_hash (data, size, &vhash);
   ret = PQexecPrepared (plugin->dbh,
-                        "put", 9, paramValues, paramLengths, paramFormats, 1);
+                        "put", 8, paramValues, paramLengths, paramFormats, 1);
   if (GNUNET_OK != check_result (plugin, ret,
                                  PGRES_COMMAND_OK,
                                  "PQexecPrepared", "put", __LINE__))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]