diff options
Diffstat (limited to 'src/psycstore/plugin_psycstore_postgres.c')
-rw-r--r-- | src/psycstore/plugin_psycstore_postgres.c | 20 |
1 files changed, 8 insertions, 12 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) | |||
166 | " fragment_offset BIGINT NOT NULL,\n" | 166 | " fragment_offset BIGINT NOT NULL,\n" |
167 | " message_id BIGINT NOT NULL,\n" | 167 | " message_id BIGINT NOT NULL,\n" |
168 | " group_generation BIGINT NOT NULL,\n" | 168 | " group_generation BIGINT NOT NULL,\n" |
169 | " multicast_flags BIGINT NOT NULL,\n" | 169 | " multicast_flags INT NOT NULL,\n" |
170 | " psycstore_flags BIGINT NOT NULL,\n" | 170 | " psycstore_flags INT NOT NULL,\n" |
171 | " data BYTEA,\n" | 171 | " data BYTEA,\n" |
172 | " PRIMARY KEY (channel_id, fragment_id),\n" | 172 | " PRIMARY KEY (channel_id, fragment_id),\n" |
173 | " UNIQUE (channel_id, message_id, fragment_offset)\n" | 173 | " UNIQUE (channel_id, message_id, fragment_offset)\n" |
@@ -765,7 +765,7 @@ fragment_store (void *cls, | |||
765 | uint64_t group_generation = GNUNET_ntohll (msg->group_generation); | 765 | uint64_t group_generation = GNUNET_ntohll (msg->group_generation); |
766 | 766 | ||
767 | uint64_t hop_counter = ntohl(msg->hop_counter); | 767 | uint64_t hop_counter = ntohl(msg->hop_counter); |
768 | uint64_t flags = ntohl(msg->flags); | 768 | uint32_t flags = ntohl(msg->flags); |
769 | 769 | ||
770 | if (fragment_id > INT64_MAX || fragment_offset > INT64_MAX || | 770 | if (fragment_id > INT64_MAX || fragment_offset > INT64_MAX || |
771 | message_id > INT64_MAX || group_generation > INT64_MAX) | 771 | message_id > INT64_MAX || group_generation > INT64_MAX) |
@@ -790,10 +790,9 @@ fragment_store (void *cls, | |||
790 | GNUNET_PQ_query_param_uint64 (&fragment_offset), | 790 | GNUNET_PQ_query_param_uint64 (&fragment_offset), |
791 | GNUNET_PQ_query_param_uint64 (&message_id), | 791 | GNUNET_PQ_query_param_uint64 (&message_id), |
792 | GNUNET_PQ_query_param_uint64 (&group_generation), | 792 | GNUNET_PQ_query_param_uint64 (&group_generation), |
793 | GNUNET_PQ_query_param_uint64 (&flags), | 793 | GNUNET_PQ_query_param_uint32 (&flags), |
794 | GNUNET_PQ_query_param_uint32 (&psycstore_flags), | 794 | GNUNET_PQ_query_param_uint32 (&psycstore_flags), |
795 | GNUNET_PQ_query_param_fixed_size (&msg[1], ntohs (msg->header.size) | 795 | GNUNET_PQ_query_param_fixed_size (&msg[1], ntohs (msg->header.size) - sizeof (*msg)), |
796 | - sizeof (*msg)), | ||
797 | GNUNET_PQ_query_param_end | 796 | GNUNET_PQ_query_param_end |
798 | }; | 797 | }; |
799 | 798 | ||
@@ -880,10 +879,9 @@ fragment_row (struct Plugin *plugin, | |||
880 | GNUNET_PQ_result_spec_uint64 ("fragment_offset", &fragment_offset), | 879 | GNUNET_PQ_result_spec_uint64 ("fragment_offset", &fragment_offset), |
881 | GNUNET_PQ_result_spec_uint64 ("message_id", &message_id), | 880 | GNUNET_PQ_result_spec_uint64 ("message_id", &message_id), |
882 | GNUNET_PQ_result_spec_uint64 ("group_generation", &group_generation), | 881 | GNUNET_PQ_result_spec_uint64 ("group_generation", &group_generation), |
883 | GNUNET_PQ_result_spec_uint64 ("msg_flags", &msg_flags), | 882 | GNUNET_PQ_result_spec_uint64 ("multicast_flags", &msg_flags), |
884 | GNUNET_PQ_result_spec_uint64 ("flags", &flags), | 883 | GNUNET_PQ_result_spec_uint64 ("psycstore_flags", &flags), |
885 | GNUNET_PQ_result_spec_variable_size ("data", &buf, | 884 | GNUNET_PQ_result_spec_variable_size ("data", &buf, &buf_size), |
886 | &buf_size), | ||
887 | GNUNET_PQ_result_spec_end | 885 | GNUNET_PQ_result_spec_end |
888 | }; | 886 | }; |
889 | 887 | ||
@@ -905,7 +903,6 @@ fragment_row (struct Plugin *plugin, | |||
905 | else | 903 | else |
906 | { | 904 | { |
907 | if (GNUNET_OK != GNUNET_PQ_extract_result(res, results, 0)) { | 905 | if (GNUNET_OK != GNUNET_PQ_extract_result(res, results, 0)) { |
908 | PQclear (res); | ||
909 | return GNUNET_SYSERR; | 906 | return GNUNET_SYSERR; |
910 | } | 907 | } |
911 | 908 | ||
@@ -933,7 +930,6 @@ fragment_row (struct Plugin *plugin, | |||
933 | ret = cb (cb_cls, mp, (enum GNUNET_PSYCSTORE_MessageFlags) flags); | 930 | ret = cb (cb_cls, mp, (enum GNUNET_PSYCSTORE_MessageFlags) flags); |
934 | } | 931 | } |
935 | 932 | ||
936 | PQclear (res); | ||
937 | return ret; | 933 | return ret; |
938 | } | 934 | } |
939 | 935 | ||