forked from boostorg/beast
file_body buffer size can be configured.
This commit is contained in:
committed by
Klemens Morgenstern
parent
99bceb5bff
commit
4ff4c79d5b
@@ -35,6 +35,13 @@ failure to do so may result in violations of ODR (One Definition Rule).
|
|||||||
Enables the use of deprecated APIs within Beast.
|
Enables the use of deprecated APIs within Beast.
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
[
|
||||||
|
[
|
||||||
|
BOOST_BEAST_FILE_BUFFER_SIZE
|
||||||
|
][
|
||||||
|
Sets the small buffer size for the file_body. Defaults to 4096.
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
@@ -113,4 +113,8 @@ namespace net = boost::asio;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef BOOST_BEAST_FILE_BUFFER_SIZE
|
||||||
|
#define BOOST_BEAST_FILE_BUFFER_SIZE 4096
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -234,9 +234,9 @@ size(value_type const& body)
|
|||||||
template<class File>
|
template<class File>
|
||||||
class basic_file_body<File>::writer
|
class basic_file_body<File>::writer
|
||||||
{
|
{
|
||||||
value_type& body_; // The body we are reading from
|
value_type& body_; // The body we are reading from
|
||||||
std::uint64_t remain_; // The number of unread bytes
|
std::uint64_t remain_; // The number of unread bytes
|
||||||
char buf_[4096]; // Small buffer for reading
|
char buf_[BOOST_BEAST_FILE_BUFFER_SIZE]; // Small buffer for reading
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// The type of buffer sequence returned by `get`.
|
// The type of buffer sequence returned by `get`.
|
||||||
|
@@ -124,9 +124,9 @@ struct basic_file_body<file_win32>
|
|||||||
basic_file_body<file_win32>, Fields>& sr,
|
basic_file_body<file_win32>, Fields>& sr,
|
||||||
error_code& ec);
|
error_code& ec);
|
||||||
|
|
||||||
value_type& body_; // The body we are reading from
|
value_type& body_; // The body we are reading from
|
||||||
std::uint64_t pos_; // The current position in the file
|
std::uint64_t pos_; // The current position in the file
|
||||||
char buf_[4096]; // Small buffer for reading
|
char buf_[BOOST_BEAST_FILE_BUFFER_SIZE]; // Small buffer for reading
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using const_buffers_type =
|
using const_buffers_type =
|
||||||
|
Reference in New Issue
Block a user