diff options
author | Julius Bünger <buenger@mytum.de> | 2015-01-16 14:18:22 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2015-01-16 14:18:22 +0000 |
commit | be799c369509a499c65ad8c6403db9703acb95b7 (patch) | |
tree | 7aa41e65639c6ead056d08abcdafb48e8d318a3e /src/rps | |
parent | ce19dd7762ac0628e489ce964fbe3d182fb45551 (diff) | |
download | gnunet-be799c369509a499c65ad8c6403db9703acb95b7.tar.gz gnunet-be799c369509a499c65ad8c6403db9703acb95b7.zip |
send empty push/pull-request messages
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 19 | ||||
-rw-r--r-- | src/rps/rps.h | 33 |
2 files changed, 7 insertions, 45 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index a4ad20121..c34569ace 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -688,10 +688,9 @@ handle_peer_push (void *cls, | |||
688 | 688 | ||
689 | // (check the proof of work) | 689 | // (check the proof of work) |
690 | 690 | ||
691 | // TODO accept empty message | 691 | if (ntohs(msg->size) != sizeof (struct GNUNET_MessageHeader)) |
692 | if (ntohs(msg->size) != sizeof (struct GNUNET_RPS_P2P_PushMessage)) | ||
693 | { | 692 | { |
694 | GNUNET_break_op (0); // At the moment our own implementation seems to break that. | 693 | GNUNET_break_op (0); |
695 | return GNUNET_SYSERR; | 694 | return GNUNET_SYSERR; |
696 | } | 695 | } |
697 | 696 | ||
@@ -727,10 +726,8 @@ handle_peer_pull_request (void *cls, | |||
727 | struct GNUNET_MQ_Envelope *ev; | 726 | struct GNUNET_MQ_Envelope *ev; |
728 | struct GNUNET_RPS_P2P_PullReplyMessage *out_msg; | 727 | struct GNUNET_RPS_P2P_PullReplyMessage *out_msg; |
729 | 728 | ||
730 | // assert that msg->size is 0 | ||
731 | 729 | ||
732 | // TODO accept empty message | 730 | if (ntohs(msg->size) != sizeof (struct GNUNET_MessageHeader)) |
733 | if (ntohs(msg->size) != sizeof (struct GNUNET_RPS_P2P_PullRequestMessage)) | ||
734 | { | 731 | { |
735 | GNUNET_break_op (0); // At the moment our own implementation seems to break that. | 732 | GNUNET_break_op (0); // At the moment our own implementation seems to break that. |
736 | return GNUNET_SYSERR; | 733 | return GNUNET_SYSERR; |
@@ -823,14 +820,13 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
823 | uint64_t i; | 820 | uint64_t i; |
824 | //unsigned int *n_arr; | 821 | //unsigned int *n_arr; |
825 | unsigned int n_peers; /* Number of peers we send pushes/pulls to */ | 822 | unsigned int n_peers; /* Number of peers we send pushes/pulls to */ |
826 | struct GNUNET_RPS_P2P_PushMessage *push_msg; | 823 | struct GNUNET_MessageHeader *push_msg; |
827 | struct GNUNET_RPS_P2P_PullRequestMessage *pull_msg; // FIXME Send empty message | 824 | struct GNUNET_MessageHeader *pull_msg; |
828 | struct GNUNET_MQ_Envelope *ev; | 825 | struct GNUNET_MQ_Envelope *ev; |
829 | const struct GNUNET_PeerIdentity *peer; | 826 | const struct GNUNET_PeerIdentity *peer; |
830 | struct GNUNET_MQ_Handle *mq; | 827 | struct GNUNET_MQ_Handle *mq; |
831 | 828 | ||
832 | // TODO print lists, ... | 829 | // TODO log lists, ... |
833 | // TODO randomise and spread calls herein over time | ||
834 | 830 | ||
835 | 831 | ||
836 | /* Would it make sense to have one shuffeled gossip list and then | 832 | /* Would it make sense to have one shuffeled gossip list and then |
@@ -853,7 +849,6 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
853 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending PUSH to peer %s of gossiped list.\n", GNUNET_i2s (peer)); | 849 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending PUSH to peer %s of gossiped list.\n", GNUNET_i2s (peer)); |
854 | 850 | ||
855 | ev = GNUNET_MQ_msg (push_msg, GNUNET_MESSAGE_TYPE_RPS_PP_PUSH); | 851 | ev = GNUNET_MQ_msg (push_msg, GNUNET_MESSAGE_TYPE_RPS_PP_PUSH); |
856 | push_msg = NULL; | ||
857 | // FIXME sometimes it returns a pointer to a freed mq | 852 | // FIXME sometimes it returns a pointer to a freed mq |
858 | mq = get_mq (peer_map, peer); | 853 | mq = get_mq (peer_map, peer); |
859 | GNUNET_MQ_send (mq, ev); | 854 | GNUNET_MQ_send (mq, ev); |
@@ -876,7 +871,7 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
876 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending PULL request to peer %s of gossiped list.\n", GNUNET_i2s (peer)); | 871 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending PULL request to peer %s of gossiped list.\n", GNUNET_i2s (peer)); |
877 | 872 | ||
878 | ev = GNUNET_MQ_msg (pull_msg, GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST); | 873 | ev = GNUNET_MQ_msg (pull_msg, GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST); |
879 | pull_msg = NULL; | 874 | //pull_msg = NULL; |
880 | mq = get_mq (peer_map, peer); | 875 | mq = get_mq (peer_map, peer); |
881 | GNUNET_MQ_send (mq, ev); | 876 | GNUNET_MQ_send (mq, ev); |
882 | } | 877 | } |
diff --git a/src/rps/rps.h b/src/rps/rps.h index 3ba0cffcf..f0f7d5461 100644 --- a/src/rps/rps.h +++ b/src/rps/rps.h | |||
@@ -53,39 +53,6 @@ struct GNUNET_RPS_P2P_PushMessage | |||
53 | uint64_t placeholder; | 53 | uint64_t placeholder; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | /** | ||
57 | * P2P Message to request PeerIDs from other peer. | ||
58 | */ | ||
59 | struct GNUNET_RPS_P2P_PullRequestMessage | ||
60 | { | ||
61 | /** | ||
62 | * Header including size and type in NBO | ||
63 | */ | ||
64 | struct GNUNET_MessageHeader header; | ||
65 | |||
66 | /* This probably stays empty as we just | ||
67 | * infrom the peer of our existence */ | ||
68 | uint64_t placeholder; | ||
69 | }; | ||
70 | |||
71 | /** | ||
72 | * P2P Message to send PeerIDs to other peer. | ||
73 | */ | ||
74 | struct GNUNET_RPS_P2P_PullReplyMessage | ||
75 | { | ||
76 | /** | ||
77 | * Header including size and type in NBO | ||
78 | */ | ||
79 | struct GNUNET_MessageHeader header; | ||
80 | |||
81 | /** | ||
82 | * Number of PeerIDs sent | ||
83 | */ | ||
84 | uint32_t num_peers GNUNET_PACKED; | ||
85 | |||
86 | /* Followed by num_peers * GNUNET_PeerIdentity */ | ||
87 | }; | ||
88 | |||
89 | 56 | ||
90 | 57 | ||
91 | /*********************************************************************** | 58 | /*********************************************************************** |