New asio: removed use of strand, and fixed steady_timer constructor call
This commit is contained in:
parent
44c2f733dc
commit
1b5f062678
3 changed files with 32 additions and 42 deletions
|
|
@ -37,8 +37,8 @@ namespace SimpleWeb {
|
|||
return asio::ip::make_address(str);
|
||||
}
|
||||
template <typename socket_type>
|
||||
io_context &get_socket_context(socket_type &socket) {
|
||||
return socket.get_executor().context();
|
||||
asio::executor get_socket_executor(socket_type &socket) {
|
||||
return socket.get_executor();
|
||||
}
|
||||
template <typename handler_type>
|
||||
void async_resolve(asio::ip::tcp::resolver &resolver, const std::pair<std::string, std::string> &host_port, handler_type &&handler) {
|
||||
|
|
@ -48,10 +48,6 @@ namespace SimpleWeb {
|
|||
void post(executor_type &executor, handler_type &&handler) {
|
||||
asio::post(executor, handler);
|
||||
}
|
||||
template <typename executor_type, typename handler_type>
|
||||
asio::executor_binder<typename asio::decay<handler_type>::type, executor_type> bind_executor(executor_type &executor, handler_type &&handler) {
|
||||
return asio::bind_executor(executor, handler);
|
||||
}
|
||||
#else
|
||||
using io_context = asio::io_service;
|
||||
using resolver_results = asio::ip::tcp::resolver::iterator;
|
||||
|
|
@ -64,7 +60,7 @@ namespace SimpleWeb {
|
|||
return asio::ip::address::from_string(str);
|
||||
}
|
||||
template <typename socket_type>
|
||||
io_context &get_socket_context(socket_type &socket) {
|
||||
io_context &get_socket_executor(socket_type &socket) {
|
||||
return socket.get_io_service();
|
||||
}
|
||||
template <typename handler_type>
|
||||
|
|
@ -75,10 +71,6 @@ namespace SimpleWeb {
|
|||
void post(executor_type &executor, handler_type &&handler) {
|
||||
executor.post(handler);
|
||||
}
|
||||
template <typename executor_type, typename handler_type>
|
||||
asio::detail::wrapped_handler<asio::io_service::strand, handler_type, asio::detail::is_continuation_if_running> bind_executor(executor_type &executor, handler_type &&handler) {
|
||||
return executor.wrap(handler);
|
||||
}
|
||||
#endif
|
||||
} // namespace SimpleWeb
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue