From: Bart Polot Date: Thu, 19 Jan 2012 22:39:41 +0000 (+0000) Subject: Fixed #2087, wrong local tunnel number sent when multiple clients are subscribed... X-Git-Tag: initial-import-from-subversion-38251~15210 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f8d053e3db33e6874e7557331aad1a0aba4de830;p=oweals%2Fgnunet.git Fixed #2087, wrong local tunnel number sent when multiple clients are subscribed to one type message on same peer and one clientis owner of the tunnel and the other is target --- diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 9f988a17e..0739e0d7d 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -850,11 +850,7 @@ send_subscribed_clients (const struct GNUNET_MessageHeader *msg, GNUNET_break (0); return 0; } - // FIXME proper client differentiation mechanism required - if (htons (msg->type) == GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN) - *tid = htonl (t->local_tid); - else - *tid = htonl (t->local_tid_dest != 0 ? t->local_tid_dest : t->local_tid); + for (count = 0, c = clients; c != NULL; c = c->next) { #if MESH_DEBUG @@ -862,6 +858,18 @@ send_subscribed_clients (const struct GNUNET_MessageHeader *msg, #endif if (client_is_subscribed (type, c)) { + // FIXME proper client differentiation mechanism required + if (htons (msg->type) == GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN) + *tid = htonl (t->local_tid); + else if(c == t->client) + *tid = htonl (t->local_tid); + else if(c == t->client_dest) + *tid = htonl (t->local_tid_dest); + else + { + GNUNET_break (0); + continue; + } count++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: sending\n"); GNUNET_SERVER_notification_context_unicast (nc, c->handle,