Skip to content

Commit ad69207

Browse files
rebased.
1 parent 2b3c1a0 commit ad69207

13 files changed

+20
-21
lines changed

Diff for: include/boost/async/io/detail/duplicate.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <boost/async/config.hpp>
1313
#include <boost/system/result.hpp>
1414

15-
namespace boost::async::io::detail
15+
namespace boost::async::detail::io
1616
{
1717

1818
#if defined(BOOST_ASIO_WINDOWS)

Diff for: include/boost/async/io/result.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct result_op
4949
auto & res = resource.emplace(buffer, sizeof(buffer),
5050
asio::get_associated_allocator(h.promise(), this_thread::get_allocator()).resource());
5151
initiate(completion_handler<Error, T>{h, result, &res, &completed_immediately});
52-
return !completed_immediately;
52+
return completed_immediately != detail::completed_immediately_t::yes;
5353
}
5454
catch(...)
5555
{
@@ -94,7 +94,7 @@ struct result_op
9494
std::optional<std::tuple<Error, T>> result;
9595
char buffer[2048];
9696
std::optional<container::pmr::monotonic_buffer_resource> resource;
97-
bool completed_immediately = false;
97+
detail::completed_immediately_t completed_immediately = detail::completed_immediately_t::no;
9898
};
9999

100100

@@ -131,7 +131,7 @@ struct result_op<void, Error>
131131
auto & res = resource.emplace(buffer, sizeof(buffer),
132132
asio::get_associated_allocator(h.promise(), this_thread::get_allocator()).resource());
133133
initiate(completion_handler<Error>{h, result, &res, &completed_immediately});
134-
return !completed_immediately;
134+
return completed_immediately != detail::completed_immediately_t::yes;
135135
}
136136
catch(...)
137137
{
@@ -178,7 +178,7 @@ struct result_op<void, Error>
178178
std::optional<std::tuple<Error>> result;
179179
char buffer[2048];
180180
std::optional<container::pmr::monotonic_buffer_resource> resource;
181-
bool completed_immediately = false;
181+
detail::completed_immediately_t completed_immediately = detail::completed_immediately_t::no;
182182
};
183183

184184

Diff for: include/boost/async/io/transfer_result.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct transfer_op
8888
auto & res = resource.emplace(buffer, sizeof(buffer),
8989
asio::get_associated_allocator(h.promise(), this_thread::get_allocator()).resource());
9090
initiate(completion_handler<system::error_code, std::size_t>{h, result, &res, &completed_immediately});
91-
return !completed_immediately;
91+
return completed_immediately != detail::completed_immediately_t::yes;
9292
}
9393
catch(...)
9494
{
@@ -131,7 +131,7 @@ struct transfer_op
131131
std::optional<std::tuple<system::error_code, std::size_t>> result;
132132
char buffer[2048];
133133
std::optional<container::pmr::monotonic_buffer_resource> resource;
134-
bool completed_immediately = false;
134+
detail::completed_immediately_t completed_immediately = detail::completed_immediately_t::no;
135135
};
136136

137137

Diff for: src/io/datagram_socket.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace boost::async::io
1313

1414
system::result<datagram_socket> datagram_socket::duplicate()
1515
{
16-
auto res = detail::duplicate_socket(datagram_socket_.native_handle());
16+
auto res = detail::io::duplicate_handle(datagram_socket_.native_handle());
1717
if (!res)
1818
return res.error();
1919

Diff for: src/io/detail/duplicate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <unistd.h>
1515
#endif
1616

17-
namespace boost::async::io::detail
17+
namespace boost::async::detail::io
1818
{
1919

2020
#if defined(BOOST_ASIO_WINDOWS)

Diff for: src/io/pipe.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void readable_pipe::async_write_some_impl_(
4949
system::error_code ec{asio::error::operation_not_supported, &loc};
5050
if (h.completed_immediately)
5151
{
52-
*h.completed_immediately = true;
52+
*h.completed_immediately = detail::completed_immediately_t::maybe;
5353
h(ec, 0ul);
5454
}
5555
else
@@ -75,7 +75,7 @@ auto readable_pipe::release() -> system::result<native_handle_type>
7575

7676
system::result<readable_pipe> readable_pipe::duplicate()
7777
{
78-
auto res = detail::duplicate_handle(pipe_.native_handle());
78+
auto res = detail::io::duplicate_handle(pipe_.native_handle());
7979
if (!res)
8080
return res.error();
8181

@@ -119,7 +119,7 @@ void writable_pipe::async_read_some_impl_(
119119
system::error_code ec{asio::error::operation_not_supported, &loc};
120120
if (h.completed_immediately)
121121
{
122-
*h.completed_immediately = true;
122+
*h.completed_immediately = detail::completed_immediately_t::maybe;
123123
h(ec, 0ul);
124124
}
125125
else
@@ -144,7 +144,7 @@ auto writable_pipe::release() -> system::result<native_handle_type>
144144

145145
system::result<writable_pipe> writable_pipe::duplicate()
146146
{
147-
auto res = detail::duplicate_handle(pipe_.native_handle());
147+
auto res = detail::io::duplicate_handle(pipe_.native_handle());
148148
if (!res)
149149
return res.error();
150150

Diff for: src/io/random_access_file.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace boost::async::io
1515

1616
system::result<random_access_file> random_access_file::duplicate()
1717
{
18-
auto res = detail::duplicate_handle(random_access_file_.native_handle());
18+
auto res = detail::io::duplicate_handle(random_access_file_.native_handle());
1919
if (!res)
2020
return res.error();
2121

Diff for: src/io/seq_packet_socket.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace boost::async::io
1313

1414
system::result<seq_packet_socket> seq_packet_socket::duplicate()
1515
{
16-
auto res = detail::duplicate_socket(seq_packet_socket_.native_handle());
16+
auto res = detail::io::duplicate_handle(seq_packet_socket_.native_handle());
1717
if (!res)
1818
return res.error();
1919

Diff for: src/io/serial_port.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ auto serial_port::release() -> system::result<native_handle_type>
145145
}
146146
auto serial_port::duplicate() -> system::result<serial_port>
147147
{
148-
auto fd = detail::duplicate_handle(serial_port_.native_handle());
148+
auto fd = detail::io::duplicate_handle(serial_port_.native_handle());
149149
if (fd.has_error())
150150
return fd.error();
151151
return serial_port(*fd);

Diff for: src/io/ssl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace boost::async::io
1515
system::result<ssl_stream> ssl_stream::duplicate()
1616
{
1717
SSL_dup(ssl_stream_.native_handle());
18-
auto res = detail::duplicate_socket(ssl_stream_.native_handle());
18+
auto res = detail::io::duplicate_handle(ssl_stream_.native_handle());
1919
if (!res)
2020
return res.error();
2121

Diff for: src/io/stream_file.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace boost::async::io
1515

1616
system::result<stream_file> stream_file::duplicate()
1717
{
18-
auto res = detail::duplicate_handle(stream_file_.native_handle());
18+
auto res = detail::io::duplicate_handle(stream_file_.native_handle());
1919
if (!res)
2020
return res.error();
2121

Diff for: src/io/stream_socket.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace boost::async::io
1313

1414
system::result<stream_socket> stream_socket::duplicate()
1515
{
16-
auto res = detail::duplicate_socket(stream_socket_.native_handle());
16+
auto res = detail::io::duplicate_handle(stream_socket_.native_handle());
1717
if (!res)
1818
return res.error();
1919

Diff for: test/io/ssl.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
CO_TEST_CASE("ssl")
1717
{
1818
using namespace boost;
19-
asio::ssl::context ctx{asio::ssl::context_base::tlsv13_client};
19+
asio::ssl::context ctx{asio::ssl::context_base::tls_client};
2020
auto t = (co_await async::io::lookup("boost.org", "https")).value();
2121
REQUIRE(!t.empty());
2222

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

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

0 commit comments

Comments
 (0)