aboutsummaryrefslogtreecommitdiff
path: root/src/psycstore
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-10-10 18:08:47 +0000
committerGabor X Toth <*@tg-x.net>2013-10-10 18:08:47 +0000
commit1d76e223b23cfcc6c0b102be41cc81a5672a05ac (patch)
treed74a08615d750ee9b696f9c8accae97057620944 /src/psycstore
parent25e99b83403ec04e691ed5543765e267705c125d (diff)
downloadgnunet-1d76e223b23cfcc6c0b102be41cc81a5672a05ac.tar.gz
gnunet-1d76e223b23cfcc6c0b102be41cc81a5672a05ac.zip
PSYCstore: result_code arg for CountersCallback
Diffstat (limited to 'src/psycstore')
-rw-r--r--src/psycstore/gnunet-service-psycstore.c2
-rw-r--r--src/psycstore/psycstore.h13
-rw-r--r--src/psycstore/psycstore_api.c2
-rw-r--r--src/psycstore/test_psycstore.c8
4 files changed, 15 insertions, 10 deletions
diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c
index a00d653b0..8a70bb22f 100644
--- a/src/psycstore/gnunet-service-psycstore.c
+++ b/src/psycstore/gnunet-service-psycstore.c
@@ -346,7 +346,7 @@ handle_counters_get (void *cls,
346 &res.max_group_generation); 346 &res.max_group_generation);
347 switch (ret) 347 switch (ret)
348 { 348 {
349 case GNUNET_YES: 349 case GNUNET_OK:
350 ret = db->counters_state_get (db->cls, &req->channel_key, 350 ret = db->counters_state_get (db->cls, &req->channel_key,
351 &res.max_state_message_id); 351 &res.max_state_message_id);
352 case GNUNET_NO: 352 case GNUNET_NO:
diff --git a/src/psycstore/psycstore.h b/src/psycstore/psycstore.h
index f28d1ba78..16d898a45 100644
--- a/src/psycstore/psycstore.h
+++ b/src/psycstore/psycstore.h
@@ -74,11 +74,6 @@ struct CountersResult
74 */ 74 */
75 uint32_t op_id GNUNET_PACKED; 75 uint32_t op_id GNUNET_PACKED;
76 76
77 /**
78 * Status code for the operation.
79 */
80 int64_t result_code GNUNET_PACKED;
81
82 uint64_t max_fragment_id GNUNET_PACKED; 77 uint64_t max_fragment_id GNUNET_PACKED;
83 78
84 uint64_t max_message_id GNUNET_PACKED; 79 uint64_t max_message_id GNUNET_PACKED;
@@ -86,6 +81,14 @@ struct CountersResult
86 uint64_t max_group_generation GNUNET_PACKED; 81 uint64_t max_group_generation GNUNET_PACKED;
87 82
88 uint64_t max_state_message_id GNUNET_PACKED; 83 uint64_t max_state_message_id GNUNET_PACKED;
84
85 /**
86 * Status code for the operation:
87 * #GNUNET_OK: success, counter values are returned.
88 * #GNUNET_NO: no message has been sent to the channel yet.
89 * #GNUNET_SYSERR: an error occurred.
90 */
91 int32_t result_code GNUNET_PACKED;
89}; 92};
90 93
91 94
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c
index 55d7f73ec..02f29ecb1 100644
--- a/src/psycstore/psycstore_api.c
+++ b/src/psycstore/psycstore_api.c
@@ -348,7 +348,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
348 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); 348 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
349 if (NULL != op->data_cb) 349 if (NULL != op->data_cb)
350 ((GNUNET_PSYCSTORE_CountersCallback) 350 ((GNUNET_PSYCSTORE_CountersCallback)
351 op->data_cb) (op->cls, 351 op->data_cb) (op->cls, ntohl (cres->result_code),
352 GNUNET_ntohll (cres->max_fragment_id), 352 GNUNET_ntohll (cres->max_fragment_id),
353 GNUNET_ntohll (cres->max_message_id), 353 GNUNET_ntohll (cres->max_message_id),
354 GNUNET_ntohll (cres->max_group_generation), 354 GNUNET_ntohll (cres->max_group_generation),
diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c
index cca3c808d..ff4e208eb 100644
--- a/src/psycstore/test_psycstore.c
+++ b/src/psycstore/test_psycstore.c
@@ -231,14 +231,16 @@ state_get_result (void *cls, int64_t result, const char *err_msg)
231 231
232 232
233void 233void
234counters_result (void *cls, uint64_t max_fragment_id, uint64_t max_message_id, 234counters_result (void *cls, int status, uint64_t max_fragment_id,
235 uint64_t max_group_generation, uint64_t max_state_message_id) 235 uint64_t max_message_id, uint64_t max_group_generation,
236 uint64_t max_state_message_id)
236{ 237{
237 struct FragmentClosure *fcls = cls; 238 struct FragmentClosure *fcls = cls;
238 int result = 0; 239 int result = 0;
239 op = NULL; 240 op = NULL;
240 241
241 if (max_fragment_id == GNUNET_ntohll (fcls->msg[2]->fragment_id) 242 if (GNUNET_OK == status
243 && max_fragment_id == GNUNET_ntohll (fcls->msg[2]->fragment_id)
242 && max_message_id == GNUNET_ntohll (fcls->msg[2]->message_id) 244 && max_message_id == GNUNET_ntohll (fcls->msg[2]->message_id)
243 && max_group_generation == GNUNET_ntohll (fcls->msg[2]->group_generation) 245 && max_group_generation == GNUNET_ntohll (fcls->msg[2]->group_generation)
244 && max_state_message_id == GNUNET_ntohll (fcls->msg[0]->message_id)) 246 && max_state_message_id == GNUNET_ntohll (fcls->msg[0]->message_id))