From 462436acba4a3dbfc73c8baf527903fbeb99a3ac Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 4 Aug 2014 18:22:54 -0400 Subject: [PATCH] handle options in proper sequence --- HTTPServer.cpp | 3 ++- Streaming.cpp | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/HTTPServer.cpp b/HTTPServer.cpp index 5dd349dd..6d8d04b5 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -543,8 +543,9 @@ namespace util } else { - std::string response ("HTTP/1.0 200 OK\r\n"); + std::string response ("HTTP/1.0 503 Not Implemented\r\n"); m_Stream->Send ((uint8_t *)response.c_str (), response.length (), 30); + m_Stream->Close (); } delete this; } diff --git a/Streaming.cpp b/Streaming.cpp index c12c4f53..5e39ea4a 100644 --- a/Streaming.cpp +++ b/Streaming.cpp @@ -29,7 +29,7 @@ namespace stream Stream::Stream (boost::asio::io_service& service, StreamingDestination * local): m_Service (service), m_SendStreamID (0), m_SequenceNumber (0), m_LastReceivedSequenceNumber (0), - m_IsOpen (false), m_IsOutgoing(true), m_LeaseSetUpdated (true), m_LocalDestination (local), + m_IsOpen (true), m_IsOutgoing(true), m_LeaseSetUpdated (true), m_LocalDestination (local), m_RemoteLeaseSet (nullptr), m_ReceiveTimer (m_Service) { m_RecvStreamID = i2p::context.GetRandomNumberGenerator ().GenerateWord32 (); @@ -114,12 +114,6 @@ namespace stream { LogPrint ("Synchronize"); } - - if (flags & PACKET_FLAG_SIGNATURE_INCLUDED) - { - LogPrint ("Signature"); - optionData += 40; - } if (flags & PACKET_FLAG_FROM_INCLUDED) { @@ -135,6 +129,18 @@ namespace stream optionData += sizeof (i2p::data::Identity); } + if (flags & PACKET_FLAG_MAX_PACKET_SIZE_INCLUDED) + { + LogPrint ("Max packet size"); + optionData += 2; + } + + if (flags & PACKET_FLAG_SIGNATURE_INCLUDED) + { + LogPrint ("Signature"); + optionData += 40; + } + packet->offset = packet->GetPayload () - packet->buf; if (packet->GetLength () > 0) {