aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/psycstore/plugin_psycstore_mysql.c33
-rw-r--r--src/psycstore/psycstore.conf.in3
-rw-r--r--src/psycstore/test_psycstore.conf3
3 files changed, 33 insertions, 6 deletions
diff --git a/src/psycstore/plugin_psycstore_mysql.c b/src/psycstore/plugin_psycstore_mysql.c
index 9357419f5..6b2acbc07 100644
--- a/src/psycstore/plugin_psycstore_mysql.c
+++ b/src/psycstore/plugin_psycstore_mysql.c
@@ -307,6 +307,7 @@ database_setup (struct Plugin *plugin)
307 "psycstore-mysql", "FILENAME"); 307 "psycstore-mysql", "FILENAME");
308 return GNUNET_SYSERR; 308 return GNUNET_SYSERR;
309 } 309 }
310 //ERROR
310 if (GNUNET_OK != GNUNET_DISK_file_test (filename)) 311 if (GNUNET_OK != GNUNET_DISK_file_test (filename))
311 { 312 {
312 if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (filename)) 313 if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (filename))
@@ -639,6 +640,7 @@ database_shutdown (struct Plugin *plugin)
639 GNUNET_MYSQL_context_destroy (plugin->mc); 640 GNUNET_MYSQL_context_destroy (plugin->mc);
640 641
641 GNUNET_free_non_null (plugin->fn); 642 GNUNET_free_non_null (plugin->fn);
643
642} 644}
643 645
644 646
@@ -1106,21 +1108,30 @@ fragment_row (struct GNUNET_MYSQL_StatementHandle *stmt,
1106 uint64_t fragment_offset; 1108 uint64_t fragment_offset;
1107 uint64_t message_id; 1109 uint64_t message_id;
1108 uint64_t group_generation; 1110 uint64_t group_generation;
1109 struct GNUNET_MULTICAST_MessageHeader msg; // to be removed...
1110 void *buf; 1111 void *buf;
1111 size_t buf_size; 1112 size_t buf_size;
1112 int ret; 1113 int ret;
1113 uint64_t flags; 1114 uint64_t flags;
1115 struct GNUNET_MULTICAST_MessageHeader msg;
1114 struct GNUNET_MULTICAST_MessageHeader *mp; 1116 struct GNUNET_MULTICAST_MessageHeader *mp;
1117
1118
1119 uint32_t hop_counter;
1120 void *signature = NULL;
1121 void *purpose = NULL;
1122 size_t signature_size;
1123 size_t purpose_size;
1124 uint32_t msg_flags;
1125
1115 struct GNUNET_MY_ResultSpec results[] = { 1126 struct GNUNET_MY_ResultSpec results[] = {
1116 GNUNET_MY_result_spec_uint32 ((uint32_t *)&msg.hop_counter), // FIXME 1127 GNUNET_MY_result_spec_uint32 (&hop_counter),
1117 GNUNET_MY_result_spec_auto_from_type (&msg.signature), // FIXME 1128 GNUNET_MY_result_spec_variable_size (&signature, &signature_size),
1118 GNUNET_MY_result_spec_auto_from_type (&msg.purpose), // FIXME 1129 GNUNET_MY_result_spec_variable_size (&purpose, &purpose_size),
1119 GNUNET_MY_result_spec_uint64 (&fragment_id), 1130 GNUNET_MY_result_spec_uint64 (&fragment_id),
1120 GNUNET_MY_result_spec_uint64 (&fragment_offset), 1131 GNUNET_MY_result_spec_uint64 (&fragment_offset),
1121 GNUNET_MY_result_spec_uint64 (&message_id), 1132 GNUNET_MY_result_spec_uint64 (&message_id),
1122 GNUNET_MY_result_spec_uint64 (&group_generation), 1133 GNUNET_MY_result_spec_uint64 (&group_generation),
1123 GNUNET_MY_result_spec_uint32 (&msg.flags), // FIXME 1134 GNUNET_MY_result_spec_uint32 (&msg_flags),
1124 GNUNET_MY_result_spec_uint64 (&flags), 1135 GNUNET_MY_result_spec_uint64 (&flags),
1125 GNUNET_MY_result_spec_variable_size (&buf, 1136 GNUNET_MY_result_spec_variable_size (&buf,
1126 &buf_size), 1137 &buf_size),
@@ -1134,16 +1145,26 @@ fragment_row (struct GNUNET_MYSQL_StatementHandle *stmt,
1134 LOG_MYSQL(plugin, 1145 LOG_MYSQL(plugin,
1135 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 1146 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
1136 "mysql extract_result", 1147 "mysql extract_result",
1137 GNUNET_MYSQL_statement_get_stmt (stmt)); 1148 stmt);
1138 return GNUNET_SYSERR; 1149 return GNUNET_SYSERR;
1139 } 1150 }
1140 1151
1141 mp = GNUNET_malloc (sizeof (msg) + buf_size); 1152 mp = GNUNET_malloc (sizeof (msg) + buf_size);
1142 *mp = msg; 1153 *mp = msg;
1154
1155 mp->hop_counter = hop_counter;
1156 GNUNET_memcpy (&mp->signature,
1157 signature,
1158 signature_size);
1159 GNUNET_memcpy (&mp->purpose,
1160 purpose,
1161 purpose_size);
1143 mp->fragment_id = GNUNET_htonll (fragment_id); 1162 mp->fragment_id = GNUNET_htonll (fragment_id);
1144 mp->fragment_offset = GNUNET_htonllk (fragment_offset); 1163 mp->fragment_offset = GNUNET_htonllk (fragment_offset);
1145 mp->message_id = GNUNET_htonllk (message_id); 1164 mp->message_id = GNUNET_htonllk (message_id);
1146 mp->group_generation = GNUNET_htonllk (group_generation); 1165 mp->group_generation = GNUNET_htonllk (group_generation);
1166 mp->flags = msg_flags;
1167
1147 GNUNET_memcpy (&mp[1], 1168 GNUNET_memcpy (&mp[1],
1148 buf, 1169 buf,
1149 buf_size); 1170 buf_size);
diff --git a/src/psycstore/psycstore.conf.in b/src/psycstore/psycstore.conf.in
index ba8b21753..2828201bd 100644
--- a/src/psycstore/psycstore.conf.in
+++ b/src/psycstore/psycstore.conf.in
@@ -15,3 +15,6 @@ DATABASE = sqlite
15 15
16[psycstore-sqlite] 16[psycstore-sqlite]
17FILENAME = $GNUNET_DATA_HOME/psycstore/sqlite.db 17FILENAME = $GNUNET_DATA_HOME/psycstore/sqlite.db
18
19[psycstore-mysql]
20FILENAME = $GNUNET_DATA_HOME/psycstore/mysql.sql
diff --git a/src/psycstore/test_psycstore.conf b/src/psycstore/test_psycstore.conf
index bf7865c88..3bccf12f1 100644
--- a/src/psycstore/test_psycstore.conf
+++ b/src/psycstore/test_psycstore.conf
@@ -6,3 +6,6 @@ DATABASE = sqlite
6 6
7[psycstore-sqlite] 7[psycstore-sqlite]
8FILENAME = $GNUNET_TEST_HOME/psycstore/sqlite_test.db 8FILENAME = $GNUNET_TEST_HOME/psycstore/sqlite_test.db
9
10[psycstore-mysql]
11FILENAME = $GNUNET_TEST_HOME/psycstore/mysql_test.sql