From 12d40e90237dd7faebf10b5ffed768f72c035b05 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 23 Mar 2014 19:48:09 -0400 Subject: [PATCH] handle streaming packet in streaming thread --- Streaming.cpp | 10 ++++++++-- Streaming.h | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Streaming.cpp b/Streaming.cpp index da1d9ac6..40bc8929 100644 --- a/Streaming.cpp +++ b/Streaming.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include "Log.h" #include "RouterInfo.h" @@ -479,8 +480,13 @@ namespace stream else delete stream; } - + void StreamingDestinations::HandleNextPacket (i2p::data::IdentHash destination, Packet * packet) + { + m_Service.post (boost::bind (&StreamingDestinations::PostNextPacket, this, destination, packet)); + } + + void StreamingDestinations::PostNextPacket (i2p::data::IdentHash destination, Packet * packet) { // TODO: we have onle one destination, might be more if (m_SharedLocalDestination) @@ -527,7 +533,7 @@ namespace stream uncompressed->len = MAX_PACKET_SIZE; } decompressor.Get (uncompressed->buf, uncompressed->len); - // then forward to streaming engine + // then forward to streaming engine thread destinations.HandleNextPacket (destination, uncompressed); } else diff --git a/Streaming.h b/Streaming.h index ac569234..484479b2 100644 --- a/Streaming.h +++ b/Streaming.h @@ -156,7 +156,7 @@ namespace stream void Start (); void Stop (); - void HandleNextPacket (i2p::data::IdentHash destination, Packet * packet); + void HandleNextPacket (i2p::data::IdentHash destination, Packet * packet); Stream * CreateClientStream (const i2p::data::LeaseSet& remote); void DeleteClientStream (Stream * stream); @@ -164,6 +164,7 @@ namespace stream private: void Run (); + void PostNextPacket (i2p::data::IdentHash destination, Packet * packet); private: