|
|
@ -36,21 +36,7 @@ namespace stream |
|
|
|
|
|
|
|
|
|
|
|
Stream::~Stream () |
|
|
|
Stream::~Stream () |
|
|
|
{ |
|
|
|
{ |
|
|
|
while (!m_ReceiveQueue.empty ()) |
|
|
|
CleanUp (); |
|
|
|
{ |
|
|
|
|
|
|
|
auto packet = m_ReceiveQueue.front (); |
|
|
|
|
|
|
|
m_ReceiveQueue.pop (); |
|
|
|
|
|
|
|
m_LocalDestination.DeletePacket (packet); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (auto it: m_SentPackets) |
|
|
|
|
|
|
|
m_LocalDestination.DeletePacket (it); |
|
|
|
|
|
|
|
m_SentPackets.clear (); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (auto it: m_SavedPackets) |
|
|
|
|
|
|
|
m_LocalDestination.DeletePacket (it); |
|
|
|
|
|
|
|
m_SavedPackets.clear (); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogPrint (eLogDebug, "Streaming: Stream deleted"); |
|
|
|
LogPrint (eLogDebug, "Streaming: Stream deleted"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -65,9 +51,29 @@ namespace stream |
|
|
|
m_SendHandler = nullptr; |
|
|
|
m_SendHandler = nullptr; |
|
|
|
handler (boost::asio::error::make_error_code (boost::asio::error::operation_aborted)); |
|
|
|
handler (boost::asio::error::make_error_code (boost::asio::error::operation_aborted)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
CleanUp (); |
|
|
|
m_LocalDestination.DeleteStream (shared_from_this ()); |
|
|
|
m_LocalDestination.DeleteStream (shared_from_this ()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Stream::CleanUp () |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_SendBuffer.str (""); |
|
|
|
|
|
|
|
while (!m_ReceiveQueue.empty ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
auto packet = m_ReceiveQueue.front (); |
|
|
|
|
|
|
|
m_ReceiveQueue.pop (); |
|
|
|
|
|
|
|
m_LocalDestination.DeletePacket (packet); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (auto it: m_SentPackets) |
|
|
|
|
|
|
|
m_LocalDestination.DeletePacket (it); |
|
|
|
|
|
|
|
m_SentPackets.clear (); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (auto it: m_SavedPackets) |
|
|
|
|
|
|
|
m_LocalDestination.DeletePacket (it); |
|
|
|
|
|
|
|
m_SavedPackets.clear (); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Stream::HandleNextPacket (Packet * packet) |
|
|
|
void Stream::HandleNextPacket (Packet * packet) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_NumReceivedBytes += packet->GetLength (); |
|
|
|
m_NumReceivedBytes += packet->GetLength (); |
|
|
|