projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
start to fix psycstore mysql
[oweals/gnunet.git]
/
src
/
psycstore
/
gnunet-service-psycstore.c
diff --git
a/src/psycstore/gnunet-service-psycstore.c
b/src/psycstore/gnunet-service-psycstore.c
index 2bcc87b2475289d525f018c1e37e4dea1afb948b..33e894b5ec292191c9179fe9bf571671c23bafb2 100644
(file)
--- a/
src/psycstore/gnunet-service-psycstore.c
+++ b/
src/psycstore/gnunet-service-psycstore.c
@@
-1,6
+1,6
@@
-/*
+/*
*
* This file is part of GNUnet
* This file is part of GNUnet
- * Copyright (C) 2013
Christian Grothoff (and other contributing authors)
+ * Copyright (C) 2013
GNUnet e.V.
*
* GNUnet is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
*
* GNUnet is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
@@
-68,10
+68,9
@@
static char *db_lib_name;
* Task run during shutdown.
*
* @param cls unused
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
*/
static void
-shutdown_task (void *cls
, const struct GNUNET_SCHEDULER_TaskContext *tc
)
+shutdown_task (void *cls)
{
if (NULL != nc)
{
{
if (NULL != nc)
{
@@
-118,7
+117,7
@@
send_result_code (struct GNUNET_SERVER_Client *client, uint64_t op_id,
res->op_id = op_id;
if (0 < err_size)
{
res->op_id = op_id;
if (0 < err_size)
{
- memcpy (&res[1], err_msg, err_size);
+
GNUNET_
memcpy (&res[1], err_msg, err_size);
((char *) &res[1])[err_size - 1] = '\0';
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
((char *) &res[1])[err_size - 1] = '\0';
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@
-202,7
+201,7
@@
send_fragment (void *cls, struct GNUNET_MULTICAST_MessageHeader *msg,
res->header.size = htons (sizeof (struct FragmentResult) + msg_size);
res->op_id = sc->op_id;
res->psycstore_flags = htonl (flags);
res->header.size = htons (sizeof (struct FragmentResult) + msg_size);
res->op_id = sc->op_id;
res->psycstore_flags = htonl (flags);
- memcpy (&res[1], msg, msg_size);
+
GNUNET_
memcpy (&res[1], msg, msg_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending fragment %ld to client\n",
GNUNET_ntohll (msg->fragment_id));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending fragment %ld to client\n",
GNUNET_ntohll (msg->fragment_id));
@@
-230,8
+229,8
@@
send_state_var (void *cls, const char *name,
res->header.size = htons (sizeof (struct StateResult) + name_size + value_size);
res->op_id = sc->op_id;
res->name_size = htons (name_size);
res->header.size = htons (sizeof (struct StateResult) + name_size + value_size);
res->op_id = sc->op_id;
res->name_size = htons (name_size);
- memcpy (&res[1], name, name_size);
- memcpy ((char *) &res[1] + name_size, value, value_size);
+
GNUNET_
memcpy (&res[1], name, name_size);
+
GNUNET_
memcpy ((char *) &res[1] + name_size, value, value_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending state variable %s to client\n", name);
GNUNET_SERVER_notification_context_add (nc, sc->client);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending state variable %s to client\n", name);
GNUNET_SERVER_notification_context_add (nc, sc->client);
@@
-384,7
+383,8
@@
handle_message_get (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Message get: invalid method prefix. size: %u < %u?\n",
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Message get: invalid method prefix. size: %u < %u?\n",
- size, sizeof (*req) + 1);
+ size,
+ (unsigned int) (sizeof (*req) + 1));
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
@@
-514,25
+514,26
@@
struct StateModifyClosure
static void
recv_state_message_part (void *cls,
static void
recv_state_message_part (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
- uint64_t message_id, uint32_t flags, uint64_t data_offset,
- const struct GNUNET_MessageHeader *msg)
+ const struct GNUNET_PSYC_MessageHeader *msg,
+ const struct GNUNET_MessageHeader *pmsg)
{
struct StateModifyClosure *scls = cls;
uint16_t psize;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"recv_state_message_part() message_id: %" PRIu64
{
struct StateModifyClosure *scls = cls;
uint16_t psize;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"recv_state_message_part() message_id: %" PRIu64
- ", data_offset: %" PRIu64 ", flags: %u\n",
- message_id, data_offset, flags);
+ ", fragment_offset: %" PRIu64 ", flags: %u\n",
+ GNUNET_ntohll (msg->message_id),
+ GNUNET_ntohll (msg->fragment_offset),
+ ntohl (msg->flags));
- if (NULL == msg)
+ if (NULL ==
p
msg)
{
scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR;
return;
}
{
scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR;
return;
}
- switch (ntohs (msg->type))
+ switch (ntohs (
p
msg->type))
{
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD:
{
{
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD:
{
@@
-543,7
+544,7
@@
recv_state_message_part (void *cls,
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER:
{
struct GNUNET_PSYC_MessageModifier *
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER:
{
struct GNUNET_PSYC_MessageModifier *
- pmod = (struct GNUNET_PSYC_MessageModifier *) msg;
+ pmod = (struct GNUNET_PSYC_MessageModifier *)
p
msg;
psize = ntohs (pmod->header.size);
uint16_t name_size = ntohs (pmod->name_size);
uint32_t value_size = ntohl (pmod->value_size);
psize = ntohs (pmod->header.size);
uint16_t name_size = ntohs (pmod->name_size);
uint32_t value_size = ntohl (pmod->value_size);
@@
-562,13
+563,13
@@
recv_state_message_part (void *cls,
{
scls->mod_oper = pmod->oper;
scls->mod_name = GNUNET_malloc (name_size);
{
scls->mod_oper = pmod->oper;
scls->mod_name = GNUNET_malloc (name_size);
- memcpy (scls->mod_name, name, name_size);
+
GNUNET_
memcpy (scls->mod_name, name, name_size);
scls->mod_value_size = value_size;
scls->mod_value = GNUNET_malloc (scls->mod_value_size);
scls->mod_value_remaining
= scls->mod_value_size - (psize - sizeof (*pmod) - name_size);
scls->mod_value_size = value_size;
scls->mod_value = GNUNET_malloc (scls->mod_value_size);
scls->mod_value_remaining
= scls->mod_value_size - (psize - sizeof (*pmod) - name_size);
- memcpy (scls->mod_value, value, value_size - scls->mod_value_remaining);
+
GNUNET_
memcpy (scls->mod_value, value, value_size - scls->mod_value_remaining);
}
}
scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER;
}
}
scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER;
@@
-583,10
+584,10
@@
recv_state_message_part (void *cls,
GNUNET_break_op (0);
scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR;
}
GNUNET_break_op (0);
scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR;
}
- psize = ntohs (msg->size);
- memcpy (scls->mod_value + (scls->mod_value_size - scls->mod_value_remaining),
- &
msg[1], psize - sizeof (*
msg));
- scls->mod_value_remaining -= psize - sizeof (*msg);
+ psize = ntohs (
p
msg->size);
+
GNUNET_
memcpy (scls->mod_value + (scls->mod_value_size - scls->mod_value_remaining),
+ &
pmsg[1], psize - sizeof (*p
msg));
+ scls->mod_value_remaining -= psize - sizeof (*
p
msg);
if (0 == scls->mod_value_remaining)
{
db->state_modify_op (db->cls, &scls->channel_key,
if (0 == scls->mod_value_remaining)
{
db->state_modify_op (db->cls, &scls->channel_key,
@@
-813,7
+814,7
@@
handle_state_get (void *cls,
if (GNUNET_NO == ret && name_size >= 5) /* min: _a_b\0 */
{
char *p, *n = GNUNET_malloc (name_size);
if (GNUNET_NO == ret && name_size >= 5) /* min: _a_b\0 */
{
char *p, *n = GNUNET_malloc (name_size);
- memcpy (n, name, name_size);
+
GNUNET_
memcpy (n, name, name_size);
while (&n[1] < (p = strrchr (n, '_')) && GNUNET_NO == ret)
{
*p = '\0';
while (&n[1] < (p = strrchr (n, '_')) && GNUNET_NO == ret)
{
*p = '\0';
@@
-946,11
+947,15
@@
run (void *cls, struct GNUNET_SERVER_Handle *server,
GNUNET_CONFIGURATION_get_value_string (cfg, "psycstore", "database",
&database))
{
GNUNET_CONFIGURATION_get_value_string (cfg, "psycstore", "database",
&database))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No database backend configured\n");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "psycstore",
+ "database");
}
else
{
}
else
{
- GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_psycstore_%s", database);
+ GNUNET_asprintf (&db_lib_name,
+ "libgnunet_plugin_psycstore_%s",
+ database);
db = GNUNET_PLUGIN_load (db_lib_name, (void *) cfg);
GNUNET_free (database);
}
db = GNUNET_PLUGIN_load (db_lib_name, (void *) cfg);
GNUNET_free (database);
}
@@
-966,8
+971,8
@@
run (void *cls, struct GNUNET_SERVER_Handle *server,
stats = GNUNET_STATISTICS_create ("psycstore", cfg);
GNUNET_SERVER_add_handlers (server, handlers);
nc = GNUNET_SERVER_notification_context_create (server, 1);
stats = GNUNET_STATISTICS_create ("psycstore", cfg);
GNUNET_SERVER_add_handlers (server, handlers);
nc = GNUNET_SERVER_notification_context_create (server, 1);
- GNUNET_SCHEDULER_add_
delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task,
- NULL);
+ GNUNET_SCHEDULER_add_
shutdown (
&shutdown_task,
+ NULL);
}
}