From 70d214d31fa35778fe37d4e56e349a5a5b178895 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 7 Aug 2012 15:36:21 +0000 Subject: Remove Handshake_IO::have_full_record and Handshake_IO::empty Have get_next_record return NONE+empty vector if no record availabe. IO::empty was completely unused. --- src/tls/tls_handshake_io.cpp | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) (limited to 'src/tls/tls_handshake_io.cpp') diff --git a/src/tls/tls_handshake_io.cpp b/src/tls/tls_handshake_io.cpp index 5cb52caf2..f46fdb094 100644 --- a/src/tls/tls_handshake_io.cpp +++ b/src/tls/tls_handshake_io.cpp @@ -60,24 +60,7 @@ void Stream_Handshake_IO::add_input(const byte rec_type, throw Decoding_Error("Unknown message type in handshake processing"); } -bool Stream_Handshake_IO::empty() const - { - return m_queue.empty(); - } - -bool Stream_Handshake_IO::have_full_record() const - { - if(m_queue.size() >= 4) - { - const size_t length = load_be24(&m_queue[1]); - - return (m_queue.size() >= length + 4); - } - - return false; - } - -std::pair > +std::pair> Stream_Handshake_IO::get_next_record() { if(m_queue.size() >= 4) @@ -97,7 +80,7 @@ Stream_Handshake_IO::get_next_record() } } - throw Internal_Error("Stream_Handshake_IO::get_next_record called without a full record"); + return std::make_pair(HANDSHAKE_NONE, std::vector()); } std::vector @@ -163,26 +146,13 @@ void Datagram_Handshake_IO::add_input(const byte rec_type, msg_len); } -bool Datagram_Handshake_IO::empty() const - { - return m_messages.find(m_in_message_seq) == m_messages.end(); - } - -bool Datagram_Handshake_IO::have_full_record() const - { - auto i = m_messages.find(m_in_message_seq); - - const bool complete = (i != m_messages.end() && i->second.complete()); - - return complete; - } - -std::pair > Datagram_Handshake_IO::get_next_record() +std::pair> +Datagram_Handshake_IO::get_next_record() { auto i = m_messages.find(m_in_message_seq); if(i == m_messages.end() || !i->second.complete()) - throw Internal_Error("Datagram_Handshake_IO::get_next_record called without a full record"); + return std::make_pair(HANDSHAKE_NONE, std::vector()); auto m = i->second.message(); -- cgit v1.2.3