Rename to max_needed for clarity

This commit is contained in:
Vinnie Falco
2013-08-15 23:48:05 -07:00
parent 4952ea2707
commit 4c605a79b7
2 changed files with 13 additions and 7 deletions

View File

@@ -29,9 +29,15 @@ public:
{
}
/** Returns the minimum number of bytes we need to succeed.
/** How many bytes maximum we might need.
This is the largest number of bytes that the detector
might need in order to come to a conclusion about
whether or not the handshake is a match. Depending
on the data, it could come to that conclusion sooner
though.
*/
virtual std::size_t needed () = 0;
virtual std::size_t max_needed () = 0;
/** Returns true if the return value of success() is valid.
*/
@@ -190,7 +196,7 @@ public:
bytesNeeded = 3
};
std::size_t needed ()
std::size_t max_needed ()
{
return bytesNeeded;
}
@@ -262,7 +268,7 @@ public:
bytesNeeded = 6
};
std::size_t needed ()
std::size_t max_needed ()
{
return bytesNeeded;
}
@@ -309,9 +315,9 @@ public:
{
}
std::size_t needed () noexcept
std::size_t max_needed () noexcept
{
return m_logic.needed ();
return m_logic.max_needed ();
}
bool finished () noexcept

View File

@@ -54,7 +54,7 @@ public:
ec = boost::system::error_code ();
m_buffer.commit (boost::asio::read (m_next_layer,
m_buffer.prepare (m_detector.needed ()), ec));
m_buffer.prepare (m_detector.max_needed ()), ec));
if (!ec)
{