[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r38133 - gnunet/src/psycstore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r38133 - gnunet/src/psycstore |
Date: |
Wed, 12 Oct 2016 18:41:37 +0200 |
Author: tg
Date: 2016-10-12 18:41:37 +0200 (Wed, 12 Oct 2016)
New Revision: 38133
Modified:
gnunet/src/psycstore/gnunet-service-psycstore.c
gnunet/src/psycstore/psycstore.h
Log:
psycstore: fix msg handlers
Modified: gnunet/src/psycstore/gnunet-service-psycstore.c
===================================================================
--- gnunet/src/psycstore/gnunet-service-psycstore.c 2016-10-12 16:41:36 UTC
(rev 38132)
+++ gnunet/src/psycstore/gnunet-service-psycstore.c 2016-10-12 16:41:37 UTC
(rev 38133)
@@ -276,6 +276,14 @@
}
+static int
+check_client_fragment_store (void *cls,
+ const struct FragmentStoreRequest *req)
+{
+ return GNUNET_OK;
+}
+
+
static void
handle_client_fragment_store (void *cls,
const struct FragmentStoreRequest *req)
@@ -282,13 +290,25 @@
{
struct GNUNET_SERVICE_Client *client = cls;
+ const struct GNUNET_MessageHeader *
+ msg = GNUNET_MQ_extract_nested_mh (req);
+ if (NULL == msg
+ || ntohs (msg->size) < sizeof (struct GNUNET_MULTICAST_MessageHeader))
+ {
+ GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Dropping invalid fragment\n"));
+ GNUNET_SERVICE_client_drop (client);
+ return;
+ }
+
int ret = db->fragment_store (db->cls, &req->channel_key,
(const struct GNUNET_MULTICAST_MessageHeader *)
- &req[1], ntohl (req->psycstore_flags));
+ msg, ntohl (req->psycstore_flags));
if (ret != GNUNET_OK)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to store fragment!\n"));
+ _("Failed to store fragment\n"));
send_result_code (client, req->op_id, ret, NULL);
GNUNET_SERVICE_client_continue (client);
@@ -352,6 +372,14 @@
}
+static int
+check_client_message_get (void *cls,
+ const struct MessageGetRequest *req)
+{
+ return GNUNET_OK;
+}
+
+
static void
handle_client_message_get (void *cls,
const struct MessageGetRequest *req)
@@ -973,7 +1001,7 @@
GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST,
struct MembershipTestRequest,
NULL),
- GNUNET_MQ_hd_fixed_size (client_fragment_store,
+ GNUNET_MQ_hd_var_size (client_fragment_store,
GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE,
struct FragmentStoreRequest,
NULL),
@@ -981,10 +1009,10 @@
GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET,
struct FragmentGetRequest,
NULL),
- GNUNET_MQ_hd_fixed_size (client_message_get,
- GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET,
- struct MessageGetRequest,
- NULL),
+ GNUNET_MQ_hd_var_size (client_message_get,
+ GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET,
+ struct MessageGetRequest,
+ NULL),
GNUNET_MQ_hd_fixed_size (client_message_get_fragment,
GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET_FRAGMENT,
struct MessageGetFragmentRequest,
@@ -994,9 +1022,9 @@
struct OperationRequest,
NULL),
GNUNET_MQ_hd_fixed_size (client_state_modify,
- GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY,
- struct StateModifyRequest,
- NULL),
+ GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY,
+ struct StateModifyRequest,
+ NULL),
GNUNET_MQ_hd_var_size (client_state_sync,
GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC,
struct StateSyncRequest,
Modified: gnunet/src/psycstore/psycstore.h
===================================================================
--- gnunet/src/psycstore/psycstore.h 2016-10-12 16:41:36 UTC (rev 38132)
+++ gnunet/src/psycstore/psycstore.h 2016-10-12 16:41:37 UTC (rev 38133)
@@ -49,7 +49,7 @@
*/
uint64_t op_id GNUNET_PACKED;
- /**
+ /**lowed by
* Status code for the operation.
*/
uint64_t result_code GNUNET_PACKED;
@@ -354,6 +354,8 @@
* #GNUNET_YES or #GNUNET_NO
*/
uint8_t do_membership_test;
+
+ /* Followed by method_prefix */
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r38133 - gnunet/src/psycstore,
gnunet <=