diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-26 23:49:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-26 23:49:36 +0000 |
commit | 7b9c1c6dade3f628e67abb8142ea8024666e8c94 (patch) | |
tree | 4896e3efe6444cf8ab3eea1cfb28fec9c6be0859 /src/core | |
parent | 54966ddcb4b15a8e84e9b7380781284013786980 (diff) | |
download | gnunet-7b9c1c6dade3f628e67abb8142ea8024666e8c94.tar.gz gnunet-7b9c1c6dade3f628e67abb8142ea8024666e8c94.zip |
fix client init handling
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/gnunet-service-core.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index fe7126d03..3964f4066 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -140,7 +140,7 @@ type_match (uint16_t type, | |||
140 | struct GSC_Client *c) | 140 | struct GSC_Client *c) |
141 | { | 141 | { |
142 | if ( (0 == c->tcnt) && | 142 | if ( (0 == c->tcnt) && |
143 | (0 != c->options) ) | 143 | (0 != (c->options & ~GNUNET_CORE_OPTION_INIT)) ) |
144 | return GNUNET_YES; /* peer without handlers and inbound/outbond | 144 | return GNUNET_YES; /* peer without handlers and inbound/outbond |
145 | callbacks matches ALL */ | 145 | callbacks matches ALL */ |
146 | if (NULL == c->types) | 146 | if (NULL == c->types) |
@@ -681,21 +681,22 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
681 | int old_match; | 681 | int old_match; |
682 | int new_match; | 682 | int new_match; |
683 | 683 | ||
684 | if (GNUNET_CORE_OPTION_NOTHING == client->options) | ||
685 | return; /* client did not yet send init */ | ||
686 | old_match = GSC_TYPEMAP_test_match (tmap_old, | 684 | old_match = GSC_TYPEMAP_test_match (tmap_old, |
687 | client->types, | 685 | client->types, |
688 | client->tcnt); | 686 | client->tcnt); |
689 | new_match = GSC_TYPEMAP_test_match (tmap_new, | 687 | new_match = GSC_TYPEMAP_test_match (tmap_new, |
690 | client->types, | 688 | client->types, |
691 | client->tcnt); | 689 | client->tcnt); |
692 | if (old_match == new_match) | 690 | if ( (old_match == new_match) && |
691 | (GNUNET_CORE_OPTION_INIT != (client->options & GNUNET_CORE_OPTION_INIT)) ) | ||
693 | { | 692 | { |
694 | GNUNET_assert (old_match == | 693 | GNUNET_assert (old_match == |
695 | GNUNET_CONTAINER_multipeermap_contains (client->connectmap, | 694 | GNUNET_CONTAINER_multipeermap_contains (client->connectmap, |
696 | neighbour)); | 695 | neighbour)); |
697 | return; /* no change */ | 696 | return; /* no change */ |
698 | } | 697 | } |
698 | if (old_match == new_match) | ||
699 | return; /* no change, but the client simply didn't INIT yet */ | ||
699 | if (GNUNET_NO == old_match) | 700 | if (GNUNET_NO == old_match) |
700 | { | 701 | { |
701 | struct ConnectNotifyMessage *cnm; | 702 | struct ConnectNotifyMessage *cnm; |
@@ -722,7 +723,7 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
722 | { | 723 | { |
723 | struct DisconnectNotifyMessage *dcm; | 724 | struct DisconnectNotifyMessage *dcm; |
724 | 725 | ||
725 | /* send disconnect */ | 726 | /* send disconnect */ |
726 | GNUNET_assert (GNUNET_YES == | 727 | GNUNET_assert (GNUNET_YES == |
727 | GNUNET_CONTAINER_multipeermap_contains (client->connectmap, | 728 | GNUNET_CONTAINER_multipeermap_contains (client->connectmap, |
728 | neighbour)); | 729 | neighbour)); |
@@ -788,7 +789,7 @@ GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, | |||
788 | GNUNET_break (0); | 789 | GNUNET_break (0); |
789 | return; | 790 | return; |
790 | } | 791 | } |
791 | if (! ( (0 != (all_client_options & options)) || | 792 | if (! ( (0 != (all_client_options & options & ~GNUNET_CORE_OPTION_INIT)) || |
792 | (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) )) | 793 | (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) )) |
793 | return; /* no client cares about this message notification */ | 794 | return; /* no client cares about this message notification */ |
794 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 795 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -807,7 +808,7 @@ GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, | |||
807 | 808 | ||
808 | tm = type_match (ntohs (msg->type), | 809 | tm = type_match (ntohs (msg->type), |
809 | c); | 810 | c); |
810 | if (! ( (0 != (c->options & options)) || | 811 | if (! ( (0 != (c->options & options & ~GNUNET_CORE_OPTION_INIT)) || |
811 | ( (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) && | 812 | ( (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) && |
812 | (GNUNET_YES == tm) ) ) ) | 813 | (GNUNET_YES == tm) ) ) ) |
813 | continue; /* neither options nor type match permit the message */ | 814 | continue; /* neither options nor type match permit the message */ |