mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 21:34:46 +02:00
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.
|
||||
]
|
||||
]
|
||||
[
|
||||
[
|
||||
BOOST_BEAST_FILE_BUFFER_SIZE
|
||||
][
|
||||
Sets the small buffer size for the file_body. Defaults to 4096.
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
@@ -113,4 +113,8 @@ namespace net = boost::asio;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_BEAST_FILE_BUFFER_SIZE
|
||||
#define BOOST_BEAST_FILE_BUFFER_SIZE 4096
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -234,9 +234,9 @@ size(value_type const& body)
|
||||
template<class File>
|
||||
class basic_file_body<File>::writer
|
||||
{
|
||||
value_type& body_; // The body we are reading from
|
||||
std::uint64_t remain_; // The number of unread bytes
|
||||
char buf_[4096]; // Small buffer for reading
|
||||
value_type& body_; // The body we are reading from
|
||||
std::uint64_t remain_; // The number of unread bytes
|
||||
char buf_[BOOST_BEAST_FILE_BUFFER_SIZE]; // Small buffer for reading
|
||||
|
||||
public:
|
||||
// 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,
|
||||
error_code& ec);
|
||||
|
||||
value_type& body_; // The body we are reading from
|
||||
std::uint64_t pos_; // The current position in the file
|
||||
char buf_[4096]; // Small buffer for reading
|
||||
value_type& body_; // The body we are reading from
|
||||
std::uint64_t pos_; // The current position in the file
|
||||
char buf_[BOOST_BEAST_FILE_BUFFER_SIZE]; // Small buffer for reading
|
||||
|
||||
public:
|
||||
using const_buffers_type =
|
||||
|
Reference in New Issue
Block a user