Skip to content

Commit 685810c

Browse files
committed
More efficient fileserver example.
This commit makes the fileserver example more efficient by eliminating the need for copying the data into multiple buffers and using the newly implemented less-copying overload for writing to connections.
1 parent 8f2276b commit 685810c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libs/network/example/http/fileserver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ struct connection_handler : boost::enable_shared_from_this<connection_handler> {
126126
std::size_t adjusted_offset = offset+4096;
127127
off_t rightmost_bound = std::min(mmaped_region.second, adjusted_offset);
128128
connection->write(
129-
boost::make_iterator_range(
129+
boost::asio::const_buffers_1(
130130
static_cast<char const *>(mmaped_region.first) + offset,
131-
static_cast<char const *>(mmaped_region.first) + rightmost_bound
131+
rightmost_bound
132132
)
133133
, boost::bind(
134134
&connection_handler::handle_chunk,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy