diff options
-rw-r--r-- | src/core/core.h | 5 | ||||
-rw-r--r-- | src/core/core_api.c | 2 | ||||
-rw-r--r-- | src/core/gnunet-service-core.c | 20 |
3 files changed, 14 insertions, 13 deletions
diff --git a/src/core/core.h b/src/core/core.h index 7a6ffa62b..7c3a5bdd8 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
@@ -45,11 +45,6 @@ | |||
45 | #define GNUNET_CORE_OPTION_NOTHING 0 | 45 | #define GNUNET_CORE_OPTION_NOTHING 0 |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * The client did properly initialize the connection. | ||
49 | */ | ||
50 | #define GNUNET_CORE_OPTION_INIT 1 | ||
51 | |||
52 | /** | ||
53 | * Client cares about connectivity changes. | 48 | * Client cares about connectivity changes. |
54 | */ | 49 | */ |
55 | #define GNUNET_CORE_OPTION_SEND_STATUS_CHANGE 4 | 50 | #define GNUNET_CORE_OPTION_SEND_STATUS_CHANGE 4 |
diff --git a/src/core/core_api.c b/src/core/core_api.c index 1c97a19d2..fda49e259 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -815,7 +815,7 @@ reconnect (struct GNUNET_CORE_Handle *h) | |||
815 | env = GNUNET_MQ_msg_extra (init, | 815 | env = GNUNET_MQ_msg_extra (init, |
816 | sizeof (uint16_t) * h->hcnt, | 816 | sizeof (uint16_t) * h->hcnt, |
817 | GNUNET_MESSAGE_TYPE_CORE_INIT); | 817 | GNUNET_MESSAGE_TYPE_CORE_INIT); |
818 | opt = GNUNET_CORE_OPTION_INIT; | 818 | opt = GNUNET_CORE_OPTION_NOTHING; |
819 | if (NULL != h->inbound_notify) | 819 | if (NULL != h->inbound_notify) |
820 | { | 820 | { |
821 | if (h->inbound_hdr_only) | 821 | if (h->inbound_hdr_only) |
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 3964f4066..b0d7b24ba 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -89,6 +89,12 @@ struct GSC_Client | |||
89 | uint32_t options; | 89 | uint32_t options; |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Have we gotten the #GNUNET_MESSAGE_TYPE_CORE_INIT message | ||
93 | * from this client already? | ||
94 | */ | ||
95 | int got_init; | ||
96 | |||
97 | /** | ||
92 | * Number of types of incoming messages this client | 98 | * Number of types of incoming messages this client |
93 | * specifically cares about. Size of the @e types array. | 99 | * specifically cares about. Size of the @e types array. |
94 | */ | 100 | */ |
@@ -140,7 +146,7 @@ type_match (uint16_t type, | |||
140 | struct GSC_Client *c) | 146 | struct GSC_Client *c) |
141 | { | 147 | { |
142 | if ( (0 == c->tcnt) && | 148 | if ( (0 == c->tcnt) && |
143 | (0 != (c->options & ~GNUNET_CORE_OPTION_INIT)) ) | 149 | (0 != c->options) ) |
144 | return GNUNET_YES; /* peer without handlers and inbound/outbond | 150 | return GNUNET_YES; /* peer without handlers and inbound/outbond |
145 | callbacks matches ALL */ | 151 | callbacks matches ALL */ |
146 | if (NULL == c->types) | 152 | if (NULL == c->types) |
@@ -188,6 +194,7 @@ handle_client_init (void *cls, | |||
188 | types = (const uint16_t *) &im[1]; | 194 | types = (const uint16_t *) &im[1]; |
189 | c->tcnt = msize / sizeof (uint16_t); | 195 | c->tcnt = msize / sizeof (uint16_t); |
190 | c->options = ntohl (im->options); | 196 | c->options = ntohl (im->options); |
197 | c->got_init = GNUNET_YES; | ||
191 | all_client_options |= c->options; | 198 | all_client_options |= c->options; |
192 | c->types = GNUNET_malloc (msize); | 199 | c->types = GNUNET_malloc (msize); |
193 | GNUNET_assert (GNUNET_YES == | 200 | GNUNET_assert (GNUNET_YES == |
@@ -681,22 +688,21 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
681 | int old_match; | 688 | int old_match; |
682 | int new_match; | 689 | int new_match; |
683 | 690 | ||
691 | if (GNUNET_YES != client->got_init) | ||
692 | return; | ||
684 | old_match = GSC_TYPEMAP_test_match (tmap_old, | 693 | old_match = GSC_TYPEMAP_test_match (tmap_old, |
685 | client->types, | 694 | client->types, |
686 | client->tcnt); | 695 | client->tcnt); |
687 | new_match = GSC_TYPEMAP_test_match (tmap_new, | 696 | new_match = GSC_TYPEMAP_test_match (tmap_new, |
688 | client->types, | 697 | client->types, |
689 | client->tcnt); | 698 | client->tcnt); |
690 | if ( (old_match == new_match) && | 699 | if (old_match == new_match) |
691 | (GNUNET_CORE_OPTION_INIT != (client->options & GNUNET_CORE_OPTION_INIT)) ) | ||
692 | { | 700 | { |
693 | GNUNET_assert (old_match == | 701 | GNUNET_assert (old_match == |
694 | GNUNET_CONTAINER_multipeermap_contains (client->connectmap, | 702 | GNUNET_CONTAINER_multipeermap_contains (client->connectmap, |
695 | neighbour)); | 703 | neighbour)); |
696 | return; /* no change */ | 704 | return; /* no change */ |
697 | } | 705 | } |
698 | if (old_match == new_match) | ||
699 | return; /* no change, but the client simply didn't INIT yet */ | ||
700 | if (GNUNET_NO == old_match) | 706 | if (GNUNET_NO == old_match) |
701 | { | 707 | { |
702 | struct ConnectNotifyMessage *cnm; | 708 | struct ConnectNotifyMessage *cnm; |
@@ -789,7 +795,7 @@ GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, | |||
789 | GNUNET_break (0); | 795 | GNUNET_break (0); |
790 | return; | 796 | return; |
791 | } | 797 | } |
792 | if (! ( (0 != (all_client_options & options & ~GNUNET_CORE_OPTION_INIT)) || | 798 | if (! ( (0 != (all_client_options & options)) || |
793 | (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) )) | 799 | (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) )) |
794 | return; /* no client cares about this message notification */ | 800 | return; /* no client cares about this message notification */ |
795 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 801 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -808,7 +814,7 @@ GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, | |||
808 | 814 | ||
809 | tm = type_match (ntohs (msg->type), | 815 | tm = type_match (ntohs (msg->type), |
810 | c); | 816 | c); |
811 | if (! ( (0 != (c->options & options & ~GNUNET_CORE_OPTION_INIT)) || | 817 | if (! ( (0 != (c->options & options)) || |
812 | ( (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) && | 818 | ( (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) && |
813 | (GNUNET_YES == tm) ) ) ) | 819 | (GNUNET_YES == tm) ) ) ) |
814 | continue; /* neither options nor type match permit the message */ | 820 | continue; /* neither options nor type match permit the message */ |