Skip to content

Commit

Permalink
rebased.
Browse files Browse the repository at this point in the history
  • Loading branch information
klemens-morgenstern committed Aug 1, 2023
1 parent 2b3c1a0 commit ad69207
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion include/boost/async/io/detail/duplicate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <boost/async/config.hpp>
#include <boost/system/result.hpp>

namespace boost::async::io::detail
namespace boost::async::detail::io
{

#if defined(BOOST_ASIO_WINDOWS)
Expand Down
8 changes: 4 additions & 4 deletions include/boost/async/io/result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct result_op
auto & res = resource.emplace(buffer, sizeof(buffer),
asio::get_associated_allocator(h.promise(), this_thread::get_allocator()).resource());
initiate(completion_handler<Error, T>{h, result, &res, &completed_immediately});
return !completed_immediately;
return completed_immediately != detail::completed_immediately_t::yes;
}
catch(...)
{
Expand Down Expand Up @@ -94,7 +94,7 @@ struct result_op
std::optional<std::tuple<Error, T>> result;
char buffer[2048];
std::optional<container::pmr::monotonic_buffer_resource> resource;
bool completed_immediately = false;
detail::completed_immediately_t completed_immediately = detail::completed_immediately_t::no;
};


Expand Down Expand Up @@ -131,7 +131,7 @@ struct result_op<void, Error>
auto & res = resource.emplace(buffer, sizeof(buffer),
asio::get_associated_allocator(h.promise(), this_thread::get_allocator()).resource());
initiate(completion_handler<Error>{h, result, &res, &completed_immediately});
return !completed_immediately;
return completed_immediately != detail::completed_immediately_t::yes;
}
catch(...)
{
Expand Down Expand Up @@ -178,7 +178,7 @@ struct result_op<void, Error>
std::optional<std::tuple<Error>> result;
char buffer[2048];
std::optional<container::pmr::monotonic_buffer_resource> resource;
bool completed_immediately = false;
detail::completed_immediately_t completed_immediately = detail::completed_immediately_t::no;
};


Expand Down
4 changes: 2 additions & 2 deletions include/boost/async/io/transfer_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ struct transfer_op
auto & res = resource.emplace(buffer, sizeof(buffer),
asio::get_associated_allocator(h.promise(), this_thread::get_allocator()).resource());
initiate(completion_handler<system::error_code, std::size_t>{h, result, &res, &completed_immediately});
return !completed_immediately;
return completed_immediately != detail::completed_immediately_t::yes;
}
catch(...)
{
Expand Down Expand Up @@ -131,7 +131,7 @@ struct transfer_op
std::optional<std::tuple<system::error_code, std::size_t>> result;
char buffer[2048];
std::optional<container::pmr::monotonic_buffer_resource> resource;
bool completed_immediately = false;
detail::completed_immediately_t completed_immediately = detail::completed_immediately_t::no;
};


Expand Down
2 changes: 1 addition & 1 deletion src/io/datagram_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace boost::async::io

system::result<datagram_socket> datagram_socket::duplicate()
{
auto res = detail::duplicate_socket(datagram_socket_.native_handle());
auto res = detail::io::duplicate_handle(datagram_socket_.native_handle());
if (!res)
return res.error();

Expand Down
2 changes: 1 addition & 1 deletion src/io/detail/duplicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <unistd.h>
#endif

namespace boost::async::io::detail
namespace boost::async::detail::io
{

#if defined(BOOST_ASIO_WINDOWS)
Expand Down
8 changes: 4 additions & 4 deletions src/io/pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void readable_pipe::async_write_some_impl_(
system::error_code ec{asio::error::operation_not_supported, &loc};
if (h.completed_immediately)
{
*h.completed_immediately = true;
*h.completed_immediately = detail::completed_immediately_t::maybe;
h(ec, 0ul);
}
else
Expand All @@ -75,7 +75,7 @@ auto readable_pipe::release() -> system::result<native_handle_type>

system::result<readable_pipe> readable_pipe::duplicate()
{
auto res = detail::duplicate_handle(pipe_.native_handle());
auto res = detail::io::duplicate_handle(pipe_.native_handle());
if (!res)
return res.error();

Expand Down Expand Up @@ -119,7 +119,7 @@ void writable_pipe::async_read_some_impl_(
system::error_code ec{asio::error::operation_not_supported, &loc};
if (h.completed_immediately)
{
*h.completed_immediately = true;
*h.completed_immediately = detail::completed_immediately_t::maybe;
h(ec, 0ul);
}
else
Expand All @@ -144,7 +144,7 @@ auto writable_pipe::release() -> system::result<native_handle_type>

system::result<writable_pipe> writable_pipe::duplicate()
{
auto res = detail::duplicate_handle(pipe_.native_handle());
auto res = detail::io::duplicate_handle(pipe_.native_handle());
if (!res)
return res.error();

Expand Down
2 changes: 1 addition & 1 deletion src/io/random_access_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace boost::async::io

system::result<random_access_file> random_access_file::duplicate()
{
auto res = detail::duplicate_handle(random_access_file_.native_handle());
auto res = detail::io::duplicate_handle(random_access_file_.native_handle());
if (!res)
return res.error();

Expand Down
2 changes: 1 addition & 1 deletion src/io/seq_packet_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace boost::async::io

system::result<seq_packet_socket> seq_packet_socket::duplicate()
{
auto res = detail::duplicate_socket(seq_packet_socket_.native_handle());
auto res = detail::io::duplicate_handle(seq_packet_socket_.native_handle());
if (!res)
return res.error();

Expand Down
2 changes: 1 addition & 1 deletion src/io/serial_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ auto serial_port::release() -> system::result<native_handle_type>
}
auto serial_port::duplicate() -> system::result<serial_port>
{
auto fd = detail::duplicate_handle(serial_port_.native_handle());
auto fd = detail::io::duplicate_handle(serial_port_.native_handle());
if (fd.has_error())
return fd.error();
return serial_port(*fd);
Expand Down
2 changes: 1 addition & 1 deletion src/io/ssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace boost::async::io
system::result<ssl_stream> ssl_stream::duplicate()
{
SSL_dup(ssl_stream_.native_handle());
auto res = detail::duplicate_socket(ssl_stream_.native_handle());
auto res = detail::io::duplicate_handle(ssl_stream_.native_handle());
if (!res)
return res.error();
Expand Down
2 changes: 1 addition & 1 deletion src/io/stream_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace boost::async::io

system::result<stream_file> stream_file::duplicate()
{
auto res = detail::duplicate_handle(stream_file_.native_handle());
auto res = detail::io::duplicate_handle(stream_file_.native_handle());
if (!res)
return res.error();

Expand Down
2 changes: 1 addition & 1 deletion src/io/stream_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace boost::async::io

system::result<stream_socket> stream_socket::duplicate()
{
auto res = detail::duplicate_socket(stream_socket_.native_handle());
auto res = detail::io::duplicate_handle(stream_socket_.native_handle());
if (!res)
return res.error();

Expand Down
3 changes: 1 addition & 2 deletions test/io/ssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
CO_TEST_CASE("ssl")
{
using namespace boost;
asio::ssl::context ctx{asio::ssl::context_base::tlsv13_client};
asio::ssl::context ctx{asio::ssl::context_base::tls_client};
auto t = (co_await async::io::lookup("boost.org", "https")).value();
REQUIRE(!t.empty());

Expand All @@ -26,6 +26,5 @@ CO_TEST_CASE("ssl")
CHECK_MESSAGE(conn, conn.error().message());

CHECK_NOTHROW(co_await ss.async_handshake(async::io::ssl_stream::handshake_type::client).value());
co_await ss.write_some("GET");
CHECK_NOTHROW(co_await ss.async_shutdown());
}

0 comments on commit ad69207

Please sign in to comment.