diff --git a/CHANGELOG.md b/CHANGELOG.md
index 55319868..23a4602a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,11 +21,17 @@ API Changes:
* Calls to stream::close and stream::async_close will
automatically perform the required read operations
+* drain_buffer is removed
+
Actions Required:
* Remove calling code which drains the connection after
calling stream::close or stream::async_close
+* Replace code which uses drain_buffer. For websocket::stream,
+ it is no longer necessary to manually drain the connection
+ after closing.
+
--------------------------------------------------------------------------------
Version 99:
diff --git a/doc/qbk/03_core/3_buffers.qbk b/doc/qbk/03_core/3_buffers.qbk
index db01d783..2295acde 100644
--- a/doc/qbk/03_core/3_buffers.qbk
+++ b/doc/qbk/03_core/3_buffers.qbk
@@ -50,15 +50,6 @@ of scenarios:
output areas equal to the size of the underlying mutable buffer sequence.
The implementation does not perform heap allocations.
]]
-[[
- [link beast.ref.boost__beast__drain_buffer `drain_buffer`]
-][
- A drain buffer has a small internal buffer and maximum size that
- uses no dynamic allocation. It always has a size of zero, and
- silently discards its input. This buffer may be passed to functions
- which store data in a dynamic buffer when the caller wishes to
- efficiently discard the data.
-]]
[[
[link beast.ref.boost__beast__flat_buffer `flat_buffer`]
[link beast.ref.boost__beast__basic_flat_buffer `basic_flat_buffer`]
diff --git a/doc/qbk/07_concepts/DynamicBuffer.qbk b/doc/qbk/07_concepts/DynamicBuffer.qbk
index 66df35d0..e7ac1dd4 100644
--- a/doc/qbk/07_concepts/DynamicBuffer.qbk
+++ b/doc/qbk/07_concepts/DynamicBuffer.qbk
@@ -126,7 +126,6 @@ implementation strategies:
* [link beast.ref.boost__beast__basic_flat_buffer `basic_flat_buffer`]
* [link beast.ref.boost__beast__basic_multi_buffer `basic_multi_buffer`]
-* [link beast.ref.boost__beast__drain_buffer `drain_buffer`]
* [link beast.ref.boost__beast__flat_buffer `flat_buffer`]
* [link beast.ref.boost__beast__flat_static_buffer `flat_static_buffer`]
* [link beast.ref.boost__beast__flat_static_buffer_base `flat_static_buffer_base`]
diff --git a/doc/qbk/quickref.xml b/doc/qbk/quickref.xml
index 2cedfba5..2e06a23d 100644
--- a/doc/qbk/quickref.xml
+++ b/doc/qbk/quickref.xml
@@ -183,7 +183,6 @@
buffered_read_stream
buffers_adapter
consuming_buffers
- drain_buffer
file
file_mode
file_posix
diff --git a/include/boost/beast/core.hpp b/include/boost/beast/core.hpp
index 9178e458..d76d2866 100644
--- a/include/boost/beast/core.hpp
+++ b/include/boost/beast/core.hpp
@@ -19,7 +19,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/include/boost/beast/core/drain_buffer.hpp b/include/boost/beast/core/drain_buffer.hpp
deleted file mode 100644
index 8d52d2d5..00000000
--- a/include/boost/beast/core/drain_buffer.hpp
+++ /dev/null
@@ -1,127 +0,0 @@
-//
-// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// Official repository: https://github.com/boostorg/beast
-//
-
-#ifndef BOOST_BEAST_DRAIN_BUFFER_HPP
-#define BOOST_BEAST_DRAIN_BUFFER_HPP
-
-#include
-#include
-#include
-
-namespace boost {
-namespace beast {
-
-/** A @b DynamicBuffer which does not retain its input sequence.
-
- This object implements a dynamic buffer with a fixed size
- output area, not dynamically allocated, and whose input
- sequence is always length zero. Bytes committed from the
- output area to the input area are always discarded. This
- is useful for calling interfaces that require a dynamic
- buffer for storage, but where the caller does not want
- to retain the data.
-*/
-class drain_buffer
-{
- char buf_[512];
- std::size_t n_ = 0;
-
-public:
- /// The type used to represent the input sequence as a list of buffers.
- using const_buffers_type = boost::asio::null_buffers;
-
- /// The type used to represent the output sequence as a list of buffers.
- using mutable_buffers_type = boost::asio::mutable_buffers_1;
-
- /// Constructor
- drain_buffer() = default;
-
- /// Copy constructor
- drain_buffer(drain_buffer const&)
- {
- // Previously returned ranges are invalidated
- }
-
- /// Copy assignment
- drain_buffer&
- operator=(drain_buffer const&)
- {
- n_ = 0;
- return *this;
- }
-
- /// Return the size of the input sequence.
- std::size_t
- size() const
- {
- return 0;
- }
-
- /// Return the maximum sum of the input and output sequence sizes.
- std::size_t
- max_size() const
- {
- return sizeof(buf_);
- }
-
- /// Return the maximum sum of input and output sizes that can be held without an allocation.
- std::size_t
- capacity() const
- {
- return max_size();
- }
-
- /** Get a list of buffers that represent the input sequence.
-
- @note These buffers remain valid across subsequent calls to `prepare`.
- */
- const_buffers_type
- data() const
- {
- return {};
- }
-
- /** Get a list of buffers that represent the output sequence, with the given size.
-
- @throws std::length_error if the size would exceed the buffer limit
- */
- mutable_buffers_type
- prepare(std::size_t n)
- {
- if(n > sizeof(buf_))
- BOOST_THROW_EXCEPTION(std::length_error{
- "buffer overflow"});
- n_ = n;
- return {buf_, n_};
- }
-
- /** Move bytes from the output sequence to the input sequence.
-
- This call always discards the output sequence.
- The size of the input sequence will remain at zero.
- */
- void
- commit(std::size_t)
- {
- }
-
- /** Remove bytes from the input sequence.
-
- This call has no effect.
- */
- void
- consume(std::size_t)
- {
- }
-};
-
-} // beast
-} // boost
-
-#endif
diff --git a/test/beast/core/CMakeLists.txt b/test/beast/core/CMakeLists.txt
index 14997e1c..d332546d 100644
--- a/test/beast/core/CMakeLists.txt
+++ b/test/beast/core/CMakeLists.txt
@@ -26,7 +26,6 @@ add_executable (tests-beast-core
buffers_adapter.cpp
clamp.cpp
consuming_buffers.cpp
- drain_buffer.cpp
error.cpp
file.cpp
file_posix.cpp
diff --git a/test/beast/core/Jamfile b/test/beast/core/Jamfile
index 42e0ba60..d78ed478 100644
--- a/test/beast/core/Jamfile
+++ b/test/beast/core/Jamfile
@@ -16,7 +16,6 @@ local SOURCES =
buffers_adapter.cpp
clamp.cpp
consuming_buffers.cpp
- drain_buffer.cpp
error.cpp
file.cpp
file_posix.cpp
diff --git a/test/beast/core/drain_buffer.cpp b/test/beast/core/drain_buffer.cpp
deleted file mode 100644
index bf0889b5..00000000
--- a/test/beast/core/drain_buffer.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// Official repository: https://github.com/boostorg/beast
-//
-
-// Test that header file is self-contained.
-#include
-
-#include
-#include
-
-namespace boost {
-namespace beast {
-
-static_assert(is_dynamic_buffer::value,
- "DynamicBuffer requirements not met");
-
-class drain_buffer_test : public beast::unit_test::suite
-{
-public:
- void
- run() override
- {
- using boost::asio::buffer_size;
- drain_buffer b;
- BEAST_EXPECT(buffer_size(b.prepare(0)) == 0);
- BEAST_EXPECT(buffer_size(b.prepare(100)) == 100);
- try
- {
- b.prepare(b.max_size() + 1);
- fail("", __FILE__, __LINE__);
- }
- catch(std::length_error const&)
- {
- pass();
- }
- b.prepare(10);
- BEAST_EXPECT(b.size() == 0);
- b.commit(10);
- BEAST_EXPECT(b.size() == 0);
- b.consume(10);
- BEAST_EXPECT(b.size() == 0);
- b.consume(1000);
- BEAST_EXPECT(b.size() == 0);
- }
-};
-
-BEAST_DEFINE_TESTSUITE(beast,core,drain_buffer);
-
-} // beast
-} // boost
diff --git a/test/beast/core/read_size.cpp b/test/beast/core/read_size.cpp
index 94059c52..69cbd262 100644
--- a/test/beast/core/read_size.cpp
+++ b/test/beast/core/read_size.cpp
@@ -10,7 +10,6 @@
// Test that header file is self-contained.
#include
-#include
#include
#include
#include
@@ -37,7 +36,6 @@ public:
void
run() override
{
- check();
check();
check>();
check();
diff --git a/test/example/server/tests.cpp b/test/example/server/tests.cpp
index d4d56a1d..833ff2d3 100644
--- a/test/example/server/tests.cpp
+++ b/test/example/server/tests.cpp
@@ -20,7 +20,6 @@
# include "example/server-framework/wss_ports.hpp"
#endif
-#include
#include
#include
#include
@@ -107,16 +106,6 @@ public:
ws.close(beast::websocket::close_code::normal, ec);
if(! BEAST_EXPECTS(! ec, ec.message()))
return;
- // VFALCO Verify the buffer's contents
- drain_buffer drain;
- for(;;)
- {
- ws.read(drain, ec);
- if(ec == beast::websocket::error::closed)
- break;
- if(! BEAST_EXPECTS(! ec, ec.message()))
- return;
- }
}
void