From: Matthias Wachs Date: Thu, 25 Aug 2011 14:17:53 +0000 (+0000) Subject: transport service sends wrong message type to transport_api X-Git-Tag: initial-import-from-subversion-38251~17311 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=39ef63326bf5818ee40a1101b499bf101a4f0fa9;p=oweals%2Fgnunet.git transport service sends wrong message type to transport_api transport api requests GNUNET_MESSAGE_TYPE_TRANSPORT_RECV for payload messages --- diff --git a/src/transport/gnunet-service-transport-new.c b/src/transport/gnunet-service-transport-new.c index 95f181835..54af9cade 100644 --- a/src/transport/gnunet-service-transport-new.c +++ b/src/transport/gnunet-service-transport-new.c @@ -156,7 +156,8 @@ static struct GNUNET_TIME_Relative plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, const struct GNUNET_TRANSPORT_ATS_Information *ats, - uint32_t ats_count, struct Session *session, + uint32_t ats_count, + struct Session *session, const char *sender_address, uint16_t sender_address_len) { @@ -222,7 +223,23 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, ntohs (message->size), &do_forward); if (do_forward == GNUNET_YES) - GST_clients_broadcast (message, GNUNET_YES); + { + struct InboundMessage * im; + size_t size = + sizeof (struct InboundMessage) + + ntohs (message->size); + + im = GNUNET_malloc (size); + im->header.size = htons (size); + im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); + im->ats_count = htonl (0); + memcpy (&(im->peer), peer, sizeof(struct GNUNET_PeerIdentity)); + memcpy (&im[1], message, ntohs (message->size)); + + GST_clients_broadcast ((const struct GNUNET_MessageHeader *) im, GNUNET_YES); + + GNUNET_free(im); + } break; } }