* Length of the list of messages pending for this client.
*/
unsigned int message_count;
+
+ /**
+ * Is this client interested in payload messages?
+ */
+ int send_payload;
};
{
const struct StartMessage *start;
struct TransportClient *tc;
+ uint32_t options;
tc = lookup_client (client);
return;
}
start = (const struct StartMessage *) message;
- if ((GNUNET_NO != ntohl (start->do_check)) &&
+ options = ntohl (start->options);
+ if ((0 != (1 & options) ) &&
(0 !=
memcmp (&start->self, &GST_my_identity,
- sizeof (struct GNUNET_PeerIdentity))))
+ sizeof (struct GNUNET_PeerIdentity))))
{
/* client thinks this is a different peer, reject */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
return;
}
tc = setup_client (client);
-
+ tc->send_payload = (0 != (2 & options));
unicast (tc, GST_hello_get (), GNUNET_NO);
GST_neighbours_iterate (¬ify_client_about_neighbour, tc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
* Broadcast the given message to all of our clients.
*
* @param msg message to broadcast
- * @param may_drop GNUNET_YES if the message can be dropped
+ * @param may_drop GNUNET_YES if the message can be dropped / is payload
*/
void
GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop)
struct TransportClient *tc;
for (tc = clients_head; tc != NULL; tc = tc->next)
+ {
+ if ( (GNUNET_YES == may_drop) &&
+ (GNUNET_YES != tc->send_payload) )
+ continue; /* skip, this client does not care about payload */
unicast (tc, msg, may_drop);
+ }
}
{
struct GNUNET_TRANSPORT_Handle *h = cls;
struct StartMessage s;
+ uint32_t options;
if (buf == NULL)
{
GNUNET_assert (size >= sizeof (struct StartMessage));
s.header.size = htons (sizeof (struct StartMessage));
s.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START);
- s.do_check = htonl (h->check_self);
+ options = 0;
+ if (h->check_self)
+ options |= 1;
+ if (h->rec != NULL)
+ options |= 2;
+ s.options = htonl (options);
s.self = h->self;
memcpy (buf, &s, sizeof (struct StartMessage));
GNUNET_CLIENT_receive (h->client, &demultiplexer, h,