diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-12 23:32:31 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-13 01:24:33 +0100 |
commit | dda2c14c04b6ef6275934e752c6952f9e35dbf44 (patch) | |
tree | d1e3cfa4340afea4878adf68ec9f2e3c470439ec /src/set | |
parent | f2d1b4fa8a76b1fdf9830b2e61d18b8c92e3eb88 (diff) | |
download | gnunet-dda2c14c04b6ef6275934e752c6952f9e35dbf44.tar.gz gnunet-dda2c14c04b6ef6275934e752c6952f9e35dbf44.zip |
improve logging, indentation
Diffstat (limited to 'src/set')
-rw-r--r-- | src/set/set_api.c | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/src/set/set_api.c b/src/set/set_api.c index bc428f9f6..f5c43a9a7 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c | |||
@@ -310,6 +310,8 @@ handle_iter_element (void *cls, | |||
310 | struct GNUNET_MQ_Envelope *ev; | 310 | struct GNUNET_MQ_Envelope *ev; |
311 | uint16_t msize; | 311 | uint16_t msize; |
312 | 312 | ||
313 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
314 | "Received element in set iteration\n"); | ||
313 | msize = ntohs (msg->header.size); | 315 | msize = ntohs (msg->header.size); |
314 | if (set->iteration_id != ntohs (msg->iteration_id)) | 316 | if (set->iteration_id != ntohs (msg->iteration_id)) |
315 | { | 317 | { |
@@ -346,7 +348,15 @@ handle_iter_done (void *cls, | |||
346 | GNUNET_SET_ElementIterator iter = set->iterator; | 348 | GNUNET_SET_ElementIterator iter = set->iterator; |
347 | 349 | ||
348 | if (NULL == iter) | 350 | if (NULL == iter) |
351 | { | ||
352 | /* FIXME: if this is true, could cancel+start a fresh one | ||
353 | cause elements to go to the wrong iteration? */ | ||
354 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
355 | "Service completed set iteration that was already cancelled\n"); | ||
349 | return; | 356 | return; |
357 | } | ||
358 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
359 | "Set iteration completed\n"); | ||
350 | set->destroy_requested = GNUNET_SYSERR; | 360 | set->destroy_requested = GNUNET_SYSERR; |
351 | set->iterator = NULL; | 361 | set->iterator = NULL; |
352 | set->iteration_id++; | 362 | set->iteration_id++; |
@@ -392,7 +402,7 @@ handle_result (void *cls, | |||
392 | int destroy_set; | 402 | int destroy_set; |
393 | 403 | ||
394 | GNUNET_assert (NULL != set->mq); | 404 | GNUNET_assert (NULL != set->mq); |
395 | result_status = ntohs (msg->result_status); | 405 | result_status = (enum GNUNET_SET_Status) ntohs (msg->result_status); |
396 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 406 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
397 | "Got result message with status %d\n", | 407 | "Got result message with status %d\n", |
398 | result_status); | 408 | result_status); |
@@ -507,6 +517,8 @@ GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh) | |||
507 | struct GNUNET_SET_CancelMessage *m; | 517 | struct GNUNET_SET_CancelMessage *m; |
508 | struct GNUNET_MQ_Envelope *mqm; | 518 | struct GNUNET_MQ_Envelope *mqm; |
509 | 519 | ||
520 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
521 | "Cancelling SET operation\n"); | ||
510 | if (NULL != set) | 522 | if (NULL != set) |
511 | { | 523 | { |
512 | mqm = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_SET_CANCEL); | 524 | mqm = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_SET_CANCEL); |
@@ -560,6 +572,9 @@ handle_client_set_error (void *cls, | |||
560 | } | 572 | } |
561 | 573 | ||
562 | 574 | ||
575 | /** | ||
576 | * FIXME. | ||
577 | */ | ||
563 | static struct GNUNET_SET_Handle * | 578 | static struct GNUNET_SET_Handle * |
564 | create_internal (const struct GNUNET_CONFIGURATION_Handle *cfg, | 579 | create_internal (const struct GNUNET_CONFIGURATION_Handle *cfg, |
565 | enum GNUNET_SET_OperationType op, | 580 | enum GNUNET_SET_OperationType op, |
@@ -618,7 +633,8 @@ create_internal (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
618 | GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_CONNECT); | 633 | GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_CONNECT); |
619 | copy_msg->cookie = *cookie; | 634 | copy_msg->cookie = *cookie; |
620 | } | 635 | } |
621 | GNUNET_MQ_send (set->mq, mqm); | 636 | GNUNET_MQ_send (set->mq, |
637 | mqm); | ||
622 | return set; | 638 | return set; |
623 | } | 639 | } |
624 | 640 | ||
@@ -638,7 +654,16 @@ struct GNUNET_SET_Handle * | |||
638 | GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | 654 | GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg, |
639 | enum GNUNET_SET_OperationType op) | 655 | enum GNUNET_SET_OperationType op) |
640 | { | 656 | { |
641 | return create_internal (cfg, op, NULL); | 657 | struct GNUNET_SET_Handle *set; |
658 | |||
659 | set = create_internal (cfg, | ||
660 | op, | ||
661 | NULL); | ||
662 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
663 | "Creating set %p for operation %d\n", | ||
664 | set, | ||
665 | op); | ||
666 | return set; | ||
642 | } | 667 | } |
643 | 668 | ||
644 | 669 | ||
@@ -664,8 +689,10 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set, | |||
664 | struct GNUNET_MQ_Envelope *mqm; | 689 | struct GNUNET_MQ_Envelope *mqm; |
665 | struct GNUNET_SET_ElementMessage *msg; | 690 | struct GNUNET_SET_ElementMessage *msg; |
666 | 691 | ||
667 | LOG (GNUNET_ERROR_TYPE_INFO, "adding element of type %u\n", (unsigned) element->element_type); | 692 | LOG (GNUNET_ERROR_TYPE_INFO, |
668 | 693 | "adding element of type %u to set %p\n", | |
694 | (unsigned int) element->element_type, | ||
695 | set); | ||
669 | if (GNUNET_YES == set->invalid) | 696 | if (GNUNET_YES == set->invalid) |
670 | { | 697 | { |
671 | if (NULL != cont) | 698 | if (NULL != cont) |
@@ -708,6 +735,9 @@ GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set, | |||
708 | struct GNUNET_MQ_Envelope *mqm; | 735 | struct GNUNET_MQ_Envelope *mqm; |
709 | struct GNUNET_SET_ElementMessage *msg; | 736 | struct GNUNET_SET_ElementMessage *msg; |
710 | 737 | ||
738 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
739 | "Removing element from set %p\n", | ||
740 | set); | ||
711 | if (GNUNET_YES == set->invalid) | 741 | if (GNUNET_YES == set->invalid) |
712 | { | 742 | { |
713 | if (NULL != cont) | 743 | if (NULL != cont) |
@@ -878,7 +908,8 @@ handle_request (void *cls, | |||
878 | struct GNUNET_SET_RejectMessage *rmsg; | 908 | struct GNUNET_SET_RejectMessage *rmsg; |
879 | 909 | ||
880 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 910 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
881 | "Processing incoming operation request\n"); | 911 | "Processing incoming operation request with id %u\n", |
912 | ntohl (msg->accept_id)); | ||
882 | /* we got another valid request => reset the backoff */ | 913 | /* we got another valid request => reset the backoff */ |
883 | lh->reconnect_backoff = GNUNET_TIME_UNIT_MILLISECONDS; | 914 | lh->reconnect_backoff = GNUNET_TIME_UNIT_MILLISECONDS; |
884 | req.accept_id = ntohl (msg->accept_id); | 915 | req.accept_id = ntohl (msg->accept_id); |
@@ -892,7 +923,8 @@ handle_request (void *cls, | |||
892 | if (GNUNET_YES == req.accepted) | 923 | if (GNUNET_YES == req.accepted) |
893 | return; /* the accept-case is handled in #GNUNET_SET_accept() */ | 924 | return; /* the accept-case is handled in #GNUNET_SET_accept() */ |
894 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 925 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
895 | "Rejecting request\n"); | 926 | "Rejected request %u\n", |
927 | ntohl (msg->accept_id)); | ||
896 | mqm = GNUNET_MQ_msg (rmsg, | 928 | mqm = GNUNET_MQ_msg (rmsg, |
897 | GNUNET_MESSAGE_TYPE_SET_REJECT); | 929 | GNUNET_MESSAGE_TYPE_SET_REJECT); |
898 | rmsg->accept_reject_id = msg->accept_id; | 930 | rmsg->accept_reject_id = msg->accept_id; |
@@ -982,6 +1014,9 @@ GNUNET_SET_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
982 | { | 1014 | { |
983 | struct GNUNET_SET_ListenHandle *lh; | 1015 | struct GNUNET_SET_ListenHandle *lh; |
984 | 1016 | ||
1017 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1018 | "Starting listener for app %s\n", | ||
1019 | GNUNET_h2s (app_id)); | ||
985 | lh = GNUNET_new (struct GNUNET_SET_ListenHandle); | 1020 | lh = GNUNET_new (struct GNUNET_SET_ListenHandle); |
986 | lh->listen_cb = listen_cb; | 1021 | lh->listen_cb = listen_cb; |
987 | lh->listen_cls = listen_cls; | 1022 | lh->listen_cls = listen_cls; |
@@ -1008,7 +1043,8 @@ void | |||
1008 | GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh) | 1043 | GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh) |
1009 | { | 1044 | { |
1010 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1045 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1011 | "Canceling listener\n"); | 1046 | "Canceling listener %s\n", |
1047 | GNUNET_h2s (&lh->app_id)); | ||
1012 | if (NULL != lh->mq) | 1048 | if (NULL != lh->mq) |
1013 | { | 1049 | { |
1014 | GNUNET_MQ_destroy (lh->mq); | 1050 | GNUNET_MQ_destroy (lh->mq); |
@@ -1050,10 +1086,12 @@ GNUNET_SET_accept (struct GNUNET_SET_Request *request, | |||
1050 | 1086 | ||
1051 | GNUNET_assert (GNUNET_NO == request->accepted); | 1087 | GNUNET_assert (GNUNET_NO == request->accepted); |
1052 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1088 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1053 | "Client accepts set operation (%d)\n", | 1089 | "Client accepts set operation (%d) with id %u\n", |
1054 | result_mode); | 1090 | result_mode, |
1091 | request->accept_id); | ||
1055 | request->accepted = GNUNET_YES; | 1092 | request->accepted = GNUNET_YES; |
1056 | mqm = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_ACCEPT); | 1093 | mqm = GNUNET_MQ_msg (msg, |
1094 | GNUNET_MESSAGE_TYPE_SET_ACCEPT); | ||
1057 | msg->accept_reject_id = htonl (request->accept_id); | 1095 | msg->accept_reject_id = htonl (request->accept_id); |
1058 | msg->result_mode = htonl (result_mode); | 1096 | msg->result_mode = htonl (result_mode); |
1059 | oh = GNUNET_new (struct GNUNET_SET_OperationHandle); | 1097 | oh = GNUNET_new (struct GNUNET_SET_OperationHandle); |
@@ -1151,6 +1189,8 @@ GNUNET_SET_copy_lazy (struct GNUNET_SET_Handle *set, | |||
1151 | struct GNUNET_MQ_Envelope *ev; | 1189 | struct GNUNET_MQ_Envelope *ev; |
1152 | struct SetCopyRequest *req; | 1190 | struct SetCopyRequest *req; |
1153 | 1191 | ||
1192 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1193 | "Creating lazy copy of set\n"); | ||
1154 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_PREPARE); | 1194 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_PREPARE); |
1155 | GNUNET_MQ_send (set->mq, ev); | 1195 | GNUNET_MQ_send (set->mq, ev); |
1156 | 1196 | ||