From 7b938b246a048ab86410d61ac0dd430a7fa2be7a Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 2 Mar 2015 16:09:59 -0500 Subject: [PATCH] choose streaming destination for destination port --- Destination.cpp | 13 +++++++++++++ Destination.h | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Destination.cpp b/Destination.cpp index 24671df8..7265f96c 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -371,11 +371,24 @@ namespace client switch (buf[9]) { case PROTOCOL_TYPE_STREAMING: + { // streaming protocol + if (toPort) // not null + { + auto it = m_StreamingDestinationsByPorts.find (toPort); + if (it != m_StreamingDestinationsByPorts.end ()) + { + // found destination for specific port + it->second->HandleDataMessagePayload (buf, length); + break; + } + } + // if port is zero, or destination for port not found, use default if (m_StreamingDestination) m_StreamingDestination->HandleDataMessagePayload (buf, length); else LogPrint ("Missing streaming destination"); + } break; case PROTOCOL_TYPE_DATAGRAM: // datagram protocol diff --git a/Destination.h b/Destination.h index f0e414a8..5650f325 100644 --- a/Destination.h +++ b/Destination.h @@ -130,7 +130,8 @@ namespace client uint32_t m_PublishReplyToken; std::set m_ExcludedFloodfills; // for publishing - std::shared_ptr m_StreamingDestination; + std::shared_ptr m_StreamingDestination; // default + std::map > m_StreamingDestinationsByPorts; i2p::datagram::DatagramDestination * m_DatagramDestination; boost::asio::deadline_timer m_PublishConfirmationTimer, m_CleanupTimer;