[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37605 - gnunet/src/psycstore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37605 - gnunet/src/psycstore |
Date: |
Fri, 29 Jul 2016 10:11:28 +0200 |
Author: christophe.genevey
Date: 2016-07-29 10:11:28 +0200 (Fri, 29 Jul 2016)
New Revision: 37605
Modified:
gnunet/src/psycstore/plugin_psycstore_mysql.c
Log:
fix fragment_get function
Modified: gnunet/src/psycstore/plugin_psycstore_mysql.c
===================================================================
--- gnunet/src/psycstore/plugin_psycstore_mysql.c 2016-07-29 00:35:41 UTC
(rev 37604)
+++ gnunet/src/psycstore/plugin_psycstore_mysql.c 2016-07-29 08:11:28 UTC
(rev 37605)
@@ -330,9 +330,9 @@
" channel_id INT NOT NULL REFERENCES
channels(id),\n"
" slave_id INT NOT NULL REFERENCES
slaves(id),\n"
" did_join INT NOT NULL,\n"
- " announced_at INT NOT NULL,\n"
- " effective_since INT NOT NULL,\n"
- " group_generation INT NOT NULL\n"
+ " announced_at BIGINT UNSIGNED NOT NULL,\n"
+ " effective_since BIGINT UNSIGNED NOT NULL,\n"
+ " group_generation BIGINT UNSIGNED NOT NULL\n"
");");
/*** FIX because IF NOT EXISTS doesn't work ***/
@@ -344,15 +344,15 @@
GNUNET_MYSQL_statement_run (plugin->mc,
"CREATE TABLE IF NOT EXISTS messages (\n"
" channel_id INT NOT NULL REFERENCES
channels(id),\n"
- " hop_counter INT NOT NULL,\n"
+ " hop_counter BIGINT UNSIGNED NOT NULL,\n"
" signature BLOB,\n"
" purpose BLOB,\n"
- " fragment_id INT NOT NULL,\n"
- " fragment_offset INT NOT NULL,\n"
- " message_id INT NOT NULL,\n"
- " group_generation INT NOT NULL,\n"
- " multicast_flags INT NOT NULL,\n"
- " psycstore_flags INT NOT NULL,\n"
+ " fragment_id BIGINT UNSIGNED NOT NULL,\n"
+ " fragment_offset BIGINT UNSIGNED NOT NULL,\n"
+ " message_id BIGINT UNSIGNED NOT NULL,\n"
+ " group_generation BIGINT UNSIGNED NOT NULL,\n"
+ " multicast_flags BIGINT UNSIGNED NOT NULL,\n"
+ " psycstore_flags BIGINT UNSIGNED NOT NULL,\n"
" data BLOB,\n"
" PRIMARY KEY (channel_id, fragment_id),\n"
" UNIQUE KEY(channel_id, message_id,
fragment_offset)\n"
@@ -952,6 +952,7 @@
GNUNET_assert (TRANSACTION_NONE == plugin->transaction);
uint64_t fragment_id = GNUNET_ntohll (msg->fragment_id);
+
uint64_t fragment_offset = GNUNET_ntohll (msg->fragment_offset);
uint64_t message_id = GNUNET_ntohll (msg->message_id);
uint64_t group_generation = GNUNET_ntohll (msg->group_generation);
@@ -978,8 +979,6 @@
GNUNET_MY_query_param_uint64 (&hop_counter),
GNUNET_MY_query_param_auto_from_type (&msg->signature),
GNUNET_MY_query_param_auto_from_type (&msg->purpose),
- //GNUNET_MY_query_param_fixed_size (&msg->signature, sizeof
(msg->signature)),
- //GNUNET_MY_query_param_fixed_size (&msg->purpose, sizeof (msg->purpose)),
GNUNET_MY_query_param_uint64 (&fragment_id),
GNUNET_MY_query_param_uint64 (&fragment_offset),
GNUNET_MY_query_param_uint64 (&message_id),
@@ -1062,27 +1061,26 @@
void *cb_cls)
{
+ uint32_t hop_counter;
+ void *signature = NULL;
+ void *purpose = NULL;
+ size_t signature_size;
+ size_t purpose_size;
+
uint64_t fragment_id;
uint64_t fragment_offset;
uint64_t message_id;
uint64_t group_generation;
+ uint64_t flags;
void *buf;
size_t buf_size;
int ret = GNUNET_SYSERR;
int sql_ret;
- uint64_t flags;
- struct GNUNET_MULTICAST_MessageHeader msg;
struct GNUNET_MULTICAST_MessageHeader *mp;
+ uint64_t msg_flags;
- uint32_t hop_counter;
- void *signature = NULL;
- void *purpose = NULL;
- size_t signature_size;
- size_t purpose_size;
- uint32_t msg_flags;
-
struct GNUNET_MY_ResultSpec results[] = {
GNUNET_MY_result_spec_uint32 (&hop_counter),
GNUNET_MY_result_spec_variable_size (&signature, &signature_size),
@@ -1091,7 +1089,7 @@
GNUNET_MY_result_spec_uint64 (&fragment_offset),
GNUNET_MY_result_spec_uint64 (&message_id),
GNUNET_MY_result_spec_uint64 (&group_generation),
- GNUNET_MY_result_spec_uint32 (&msg_flags),
+ GNUNET_MY_result_spec_uint64 (&msg_flags),
GNUNET_MY_result_spec_uint64 (&flags),
GNUNET_MY_result_spec_variable_size (&buf,
&buf_size),
@@ -1108,9 +1106,11 @@
break;
case GNUNET_OK:
- mp = GNUNET_malloc (sizeof (msg) + buf_size);
- *mp = msg;
- mp->hop_counter = hop_counter;
+ mp = GNUNET_malloc (sizeof (*mp) + buf_size);
+
+ mp->header.size = htons (sizeof (*mp) + buf_size);
+ mp->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE);
+ mp->hop_counter = htonl (hop_counter);
GNUNET_memcpy (&mp->signature,
signature,
signature_size);
@@ -1121,7 +1121,7 @@
mp->fragment_offset = GNUNET_htonll (fragment_offset);
mp->message_id = GNUNET_htonll (message_id);
mp->group_generation = GNUNET_htonll (group_generation);
- mp->flags = msg_flags;
+ mp->flags = htonl(msg_flags);
GNUNET_memcpy (&mp[1],
buf,
@@ -1129,9 +1129,9 @@
ret = cb (cb_cls,
mp,
(enum GNUNET_PSYCSTORE_MessageFlags) flags);
- if (ret != GNUNET_YES)
- sql_ret = GNUNET_NO;
- GNUNET_free (mp);
+
+ GNUNET_MY_cleanup_result (results);
+
break;
default:
LOG_MYSQL(plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
@@ -1138,8 +1138,6 @@
"mysql extract_result", stmt);
}
-// GNUNET_MY_cleanup_result (results);
-
return ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37605 - gnunet/src/psycstore,
gnunet <=