diff options
author | Arthur Dewarumez <arthur.dewarumez@etudiant.univ-lille1.fr> | 2015-04-28 09:33:05 +0000 |
---|---|---|
committer | Arthur Dewarumez <arthur.dewarumez@etudiant.univ-lille1.fr> | 2015-04-28 09:33:05 +0000 |
commit | 8b0472be26c33243e4867f8fab2a865b0e2084d9 (patch) | |
tree | 01eb64dd1c5af43e8d69cff6be0c353a036cc640 /src/dht | |
parent | 14bf32756ebf311aed2421fd19217e20e538f7b5 (diff) | |
download | gnunet-8b0472be26c33243e4867f8fab2a865b0e2084d9.tar.gz gnunet-8b0472be26c33243e4867f8fab2a865b0e2084d9.zip |
Add some comments in the handler functions.
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-service-wdht_neighbours.c | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/src/dht/gnunet-service-wdht_neighbours.c b/src/dht/gnunet-service-wdht_neighbours.c index 15d7843ad..2f48ae387 100644 --- a/src/dht/gnunet-service-wdht_neighbours.c +++ b/src/dht/gnunet-service-wdht_neighbours.c | |||
@@ -51,6 +51,16 @@ | |||
51 | */ | 51 | */ |
52 | #define FOO_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2) | 52 | #define FOO_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2) |
53 | 53 | ||
54 | /** | ||
55 | * The number of layered ID to use. | ||
56 | */ | ||
57 | #define NUMBER_LAYERED_ID 8 | ||
58 | |||
59 | /** | ||
60 | * Contains all the layered ID. | ||
61 | */ | ||
62 | struct GNUNET_PeerIdentity layered_id[NUMBER_LAYERED_ID]; | ||
63 | |||
54 | 64 | ||
55 | GNUNET_NETWORK_STRUCT_BEGIN | 65 | GNUNET_NETWORK_STRUCT_BEGIN |
56 | 66 | ||
@@ -618,6 +628,14 @@ handle_dht_p2p_finger_setup (void *cls, | |||
618 | 628 | ||
619 | fsm = (const struct FingerSetupMessage *) message; | 629 | fsm = (const struct FingerSetupMessage *) message; |
620 | 630 | ||
631 | /* | ||
632 | * Steps : | ||
633 | * 1 check if the hops_taken is < to log(honest node) | ||
634 | * 1.a.1 if true : increments the hops_taken | ||
635 | * 1.a.2 send the same structure | ||
636 | * 1.b if false : drop the message | ||
637 | */ | ||
638 | |||
621 | return GNUNET_OK; | 639 | return GNUNET_OK; |
622 | } | 640 | } |
623 | 641 | ||
@@ -639,6 +657,13 @@ handle_dht_p2p_finger_setup_response (void *cls, | |||
639 | 657 | ||
640 | fsm = (const struct FingerSetupResponseMessage *) message; | 658 | fsm = (const struct FingerSetupResponseMessage *) message; |
641 | 659 | ||
660 | /* | ||
661 | * Steps : | ||
662 | * 1 check if we are the correct layer | ||
663 | * 1.a if true : add the return value in the db structure | ||
664 | * 1.b if true : do nothing | ||
665 | */ | ||
666 | |||
642 | return GNUNET_OK; | 667 | return GNUNET_OK; |
643 | } | 668 | } |
644 | 669 | ||
@@ -660,6 +685,15 @@ handle_dht_p2p_finger_destroy (void *cls, | |||
660 | 685 | ||
661 | fdm = (const struct FingerDestroyMessage *) message; | 686 | fdm = (const struct FingerDestroyMessage *) message; |
662 | 687 | ||
688 | /* | ||
689 | * Steps : | ||
690 | * 1 check if message comme from a trail | ||
691 | * 1.a.1 if true: send the destroy message to the rest trail | ||
692 | * 1.a.2 clean the trail structure | ||
693 | * 1.a.3 did i have to remove the trail and ID from the db structure? | ||
694 | * 1.b if false: do nothing | ||
695 | */ | ||
696 | |||
663 | return GNUNET_OK; | 697 | return GNUNET_OK; |
664 | } | 698 | } |
665 | 699 | ||
@@ -681,6 +715,12 @@ handle_dht_p2p_finger_route (void *cls, | |||
681 | frm = (const struct FingerRouteMessage *) message; | 715 | frm = (const struct FingerRouteMessage *) message; |
682 | /* FIXME: check the size of the message */ | 716 | /* FIXME: check the size of the message */ |
683 | 717 | ||
718 | /* | ||
719 | * steps : | ||
720 | * 1 find the good trail | ||
721 | * 2 send the finger route message | ||
722 | */ | ||
723 | |||
684 | return GNUNET_OK; | 724 | return GNUNET_OK; |
685 | } | 725 | } |
686 | 726 | ||
@@ -743,10 +783,10 @@ handle_dht_p2p_peer_get (void *cls, | |||
743 | 783 | ||
744 | pgm = (const struct PeerGetMessage *) message; | 784 | pgm = (const struct PeerGetMessage *) message; |
745 | 785 | ||
746 | /* | 786 | /* |
747 | * steps : | 787 | * steps : |
748 | * 1 extract the result | 788 | * 1 extract the result |
749 | * 2 create a peerGetResult struct | 789 | * 2 save the peer |
750 | * 3 send it using the good trail | 790 | * 3 send it using the good trail |
751 | * | 791 | * |
752 | * What do i do when i don't have the key/value? | 792 | * What do i do when i don't have the key/value? |
@@ -772,6 +812,15 @@ handle_dht_p2p_peer_get_result (void *cls, | |||
772 | 812 | ||
773 | pgrm = (const struct PeerGetResultMessage *) message; | 813 | pgrm = (const struct PeerGetResultMessage *) message; |
774 | 814 | ||
815 | /* | ||
816 | * steps : | ||
817 | * 1 extract the result | ||
818 | * 2 create a peerGetResult struct | ||
819 | * 3 send it using the good trail | ||
820 | * | ||
821 | * What do i do when i don't have the key/value? | ||
822 | */ | ||
823 | |||
775 | return GNUNET_OK; | 824 | return GNUNET_OK; |
776 | } | 825 | } |
777 | 826 | ||
@@ -792,6 +841,12 @@ handle_dht_p2p_peer_put (void *cls, | |||
792 | 841 | ||
793 | pgrm = (const struct PeerGetResultMessage *) message; | 842 | pgrm = (const struct PeerGetResultMessage *) message; |
794 | 843 | ||
844 | /* | ||
845 | * steps : | ||
846 | * 1 check the size of the message | ||
847 | * 2 use the API to add the value in the "database". Check on the xdht file, how to do it. | ||
848 | * 3 Did i a have to return a notification or did i have to return GNUNET_[OK|SYSERR]? | ||
849 | */ | ||
795 | return GNUNET_OK; | 850 | return GNUNET_OK; |
796 | } | 851 | } |
797 | 852 | ||