From 9371fa2437cdac5abe624670b528da859a0a0025 Mon Sep 17 00:00:00 2001 From: Gabor X Toth <*@tg-x.net> Date: Wed, 12 Oct 2016 19:58:23 +0000 Subject: [PATCH] psycstore: postgres fixes --- src/psycstore/plugin_psycstore_postgres.c | 20 ++++++++------------ src/psycstore/test_plugin_psycstore.c | 11 ----------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/psycstore/plugin_psycstore_postgres.c b/src/psycstore/plugin_psycstore_postgres.c index 147e70bd6..5bbb3c447 100644 --- a/src/psycstore/plugin_psycstore_postgres.c +++ b/src/psycstore/plugin_psycstore_postgres.c @@ -166,8 +166,8 @@ database_setup (struct Plugin *plugin) " fragment_offset BIGINT NOT NULL,\n" " message_id BIGINT NOT NULL,\n" " group_generation BIGINT NOT NULL,\n" - " multicast_flags BIGINT NOT NULL,\n" - " psycstore_flags BIGINT NOT NULL,\n" + " multicast_flags INT NOT NULL,\n" + " psycstore_flags INT NOT NULL,\n" " data BYTEA,\n" " PRIMARY KEY (channel_id, fragment_id),\n" " UNIQUE (channel_id, message_id, fragment_offset)\n" @@ -765,7 +765,7 @@ fragment_store (void *cls, uint64_t group_generation = GNUNET_ntohll (msg->group_generation); uint64_t hop_counter = ntohl(msg->hop_counter); - uint64_t flags = ntohl(msg->flags); + uint32_t flags = ntohl(msg->flags); if (fragment_id > INT64_MAX || fragment_offset > INT64_MAX || message_id > INT64_MAX || group_generation > INT64_MAX) @@ -790,10 +790,9 @@ fragment_store (void *cls, GNUNET_PQ_query_param_uint64 (&fragment_offset), GNUNET_PQ_query_param_uint64 (&message_id), GNUNET_PQ_query_param_uint64 (&group_generation), - GNUNET_PQ_query_param_uint64 (&flags), + GNUNET_PQ_query_param_uint32 (&flags), GNUNET_PQ_query_param_uint32 (&psycstore_flags), - GNUNET_PQ_query_param_fixed_size (&msg[1], ntohs (msg->header.size) - - sizeof (*msg)), + GNUNET_PQ_query_param_fixed_size (&msg[1], ntohs (msg->header.size) - sizeof (*msg)), GNUNET_PQ_query_param_end }; @@ -880,10 +879,9 @@ fragment_row (struct Plugin *plugin, GNUNET_PQ_result_spec_uint64 ("fragment_offset", &fragment_offset), GNUNET_PQ_result_spec_uint64 ("message_id", &message_id), GNUNET_PQ_result_spec_uint64 ("group_generation", &group_generation), - GNUNET_PQ_result_spec_uint64 ("msg_flags", &msg_flags), - GNUNET_PQ_result_spec_uint64 ("flags", &flags), - GNUNET_PQ_result_spec_variable_size ("data", &buf, - &buf_size), + GNUNET_PQ_result_spec_uint64 ("multicast_flags", &msg_flags), + GNUNET_PQ_result_spec_uint64 ("psycstore_flags", &flags), + GNUNET_PQ_result_spec_variable_size ("data", &buf, &buf_size), GNUNET_PQ_result_spec_end }; @@ -905,7 +903,6 @@ fragment_row (struct Plugin *plugin, else { if (GNUNET_OK != GNUNET_PQ_extract_result(res, results, 0)) { - PQclear (res); return GNUNET_SYSERR; } @@ -933,7 +930,6 @@ fragment_row (struct Plugin *plugin, ret = cb (cb_cls, mp, (enum GNUNET_PSYCSTORE_MessageFlags) flags); } - PQclear (res); return ret; } diff --git a/src/psycstore/test_plugin_psycstore.c b/src/psycstore/test_plugin_psycstore.c index c282844ad..8bc1407cd 100644 --- a/src/psycstore/test_plugin_psycstore.c +++ b/src/psycstore/test_plugin_psycstore.c @@ -279,17 +279,6 @@ run (void *cls, char *const *args, const char *cfgfile, &ret_frags, fragment_cb, &fcls)); GNUNET_assert (fcls.n == 1); -#if GABOR - LOG (GNUNET_ERROR_TYPE_INFO, "fragment_get(%" PRIu64 ")\n", fragment_id+1); - ret_frags = 0; - GNUNET_assert ( - GNUNET_OK == db->fragment_get (db->cls, &channel_pub_key, - fragment_id+1, fragment_id+1, - &ret_frags, fragment_cb, &fcls)); - GNUNET_assert (fcls.n == 1); - - // FIXME: test fragment_get_latest and message_get_latest -#endif LOG (GNUNET_ERROR_TYPE_INFO, "message_get_fragment()\n"); fcls.n = 0; -- 2.25.1