diff --git a/include/boost/winasio/named_pipe/named_pipe.hpp b/include/boost/winasio/named_pipe/named_pipe.hpp index aa3f373..5f67358 100644 --- a/include/boost/winasio/named_pipe/named_pipe.hpp +++ b/include/boost/winasio/named_pipe/named_pipe.hpp @@ -75,16 +75,17 @@ class named_pipe : public boost::asio::windows::basic_stream_handle { parent_type::assign(hPipe); } - template - auto async_server_connect(Token && token){ - return boost::asio::async_initiate( + template auto async_server_connect(Token &&token) { + return boost::asio::async_initiate( [this](auto handler) { // init optr to pass through the user handler. - boost::asio::windows::overlapped_ptr optr(this->get_executor(), - [h=std::move(handler)](boost::system::error_code ec, std::size_t) mutable { - std::move(h)(ec); - }); + boost::asio::windows::overlapped_ptr optr( + this->get_executor(), + [h = std::move(handler)](boost::system::error_code ec, + std::size_t) mutable { + std::move(h)(ec); + }); boost::system::error_code ec; bool fConnected = false; fConnected = ConnectNamedPipe(this->native_handle(), optr.get()); @@ -92,7 +93,7 @@ class named_pipe : public boost::asio::windows::basic_stream_handle { if (fConnected) { // printf("ConnectNamedPipe failed with %d.\n", GetLastError()); ec = boost::system::error_code(::GetLastError(), - boost::system::system_category()); + boost::system::system_category()); optr.complete(ec, 0); return; } @@ -104,17 +105,18 @@ class named_pipe : public boost::asio::windows::basic_stream_handle { break; // Client is already connected, so signal an event. case ERROR_PIPE_CONNECTED: { - // In the win32 example here we need to reset the overlapp event when pipe - // already is connected. But this case overlapped_ptr cannot trigger this - // because iocp does not register this pipe instance. + // In the win32 example here we need to reset the overlapp event + // when pipe already is connected. But this case overlapped_ptr + // cannot trigger this because iocp does not register this pipe + // instance. optr.complete(ec, 0); break; } // If an error occurs during the connect operation... default: { // printf("Some named pipe op failed with %d.\n", GetLastError()); - ec = boost::system::error_code(::GetLastError(), - boost::asio::error::get_system_category()); + ec = boost::system::error_code( + ::GetLastError(), boost::asio::error::get_system_category()); optr.complete(ec, 0); } } diff --git a/include/boost/winasio/named_pipe/named_pipe_acceptor.hpp b/include/boost/winasio/named_pipe/named_pipe_acceptor.hpp index 5ec6d03..a6c7bf5 100644 --- a/include/boost/winasio/named_pipe/named_pipe_acceptor.hpp +++ b/include/boost/winasio/named_pipe/named_pipe_acceptor.hpp @@ -57,7 +57,7 @@ template class named_pipe_acceptor { BOOST_ASIO_MOVE_ARG(AcceptToken) token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) { return boost::asio::async_initiate( + void(boost::system::error_code)>( [this, &pipe](auto handler) { boost::system::error_code ec; pipe.server_create(ec, endpoint_); @@ -65,9 +65,9 @@ template class named_pipe_acceptor { std::move(handler)(ec); return; } - pipe.async_server_connect([h=std::move(handler), this](boost::system::error_code ec) mutable { - std::move(h)(ec); - }); + pipe.async_server_connect( + [h = std::move(handler), this]( + boost::system::error_code ec) mutable { std::move(h)(ec); }); }, token); } @@ -83,8 +83,8 @@ template class named_pipe_acceptor { async_accept(BOOST_ASIO_MOVE_ARG(MoveAcceptToken) token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) { return boost::asio::async_initiate)>( + void(boost::system::error_code, + named_pipe)>( [this](auto handler) { boost::system::error_code ec; pipe_.server_create(ec, endpoint_); @@ -92,7 +92,8 @@ template class named_pipe_acceptor { std::move(handler)(ec, std::move(pipe_)); return; } - pipe_.async_server_connect([h=std::move(handler), this](boost::system::error_code ec) mutable { + pipe_.async_server_connect([h = std::move(handler), this]( + boost::system::error_code ec) mutable { std::move(h)(ec, std::move(pipe_)); }); }, diff --git a/include/boost/winasio/named_pipe/named_pipe_server_details.hpp b/include/boost/winasio/named_pipe/named_pipe_server_details.hpp index 208b27f..c76e344 100644 --- a/include/boost/winasio/named_pipe/named_pipe_server_details.hpp +++ b/include/boost/winasio/named_pipe/named_pipe_server_details.hpp @@ -18,10 +18,7 @@ namespace boost { namespace winasio { -namespace details { - - -} // namespace details +namespace details {} // namespace details } // namespace winasio } // namespace boost