Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit897de7b

Browse files
committed
Fixed async_connection::write() SFINAE-isation
Overloaded function selection based on ConstBufferSeq::value_type.http_server_async_less_copy test fixed accordingly.
1 parent6ca564d commit897de7b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

‎boost/network/protocol/http/server/async_connection.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@ namespace boost { namespace network { namespace http {
214214
}
215215

216216
template<classRange,classCallback>
217-
typename disable_if<is_base_of<asio::const_buffer, Range>,void>::type
217+
typename disable_if<is_base_of<asio::const_buffer,typenameRange::value_type>,void>::type
218218
write(Rangeconst & range, Callbackconst & callback) {
219219
lock_guardlock(headers_mutex);
220220
if (error_encountered)boost::throw_exception(boost::system::system_error(*error_encountered));
221221
write_impl(boost::make_iterator_range(range), callback);
222222
}
223223

224224
template<classConstBufferSeq,classCallback>
225-
typename enable_if<is_base_of<asio::const_buffer, ConstBufferSeq>,void>::type
225+
typename enable_if<is_base_of<asio::const_buffer,typenameConstBufferSeq::value_type>,void>::type
226226
write(ConstBufferSeqconst & seq, Callbackconst & callback)
227227
{
228228
write_vec_impl(seq, callback,shared_array_list(),shared_buffers());

‎libs/network/test/http_server_async_less_copy.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#defineBOOST_TEST_MODULE HTTP Asynchronous Server Tests
88

9+
#include<vector>
10+
911
#include<boost/config/warning_disable.hpp>
1012
#include<boost/network/include/http/server.hpp>
1113
#include<boost/network/utils/thread_pool.hpp>
@@ -51,9 +53,9 @@ struct async_hello_world {
5153
staticcharconst * hello_world ="Hello, World!";
5254
connection->set_status(server::connection::ok);
5355
connection->set_headers(boost::make_iterator_range(headers, headers+3));
54-
connection->write(
55-
boost::asio::const_buffers_1(hello_world,13)
56-
,boost::bind(&async_hello_world::error,this, _1));
56+
std::vector<boost::asio::const_buffer> iovec;
57+
iovec.push_back(boost::asio::const_buffer(hello_world,13));
58+
connection->write(iovec,boost::bind(&async_hello_world::error,this, _1));
5759
}
5860
}
5961

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp