Skip to content

Commit dbfa778

Browse files
authored
Merge pull request #45 from amensel/asio-no-deprecated
Looks good so far! Thank you for your contribution, I'll make a new release soon.
2 parents d3ea846 + df40dd7 commit dbfa778

26 files changed

+55
-65
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enable_testing()
1010

1111
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
1212
add_definitions(-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
13+
add_definitions(-DBOOST_ASIO_NO_DEPRECATED)
1314
#add_definitions(-DBREDIS_DEBUG)
1415

1516
find_package(

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ using Iterator = typename r::to_iterator<Buffer>::iterator_t;
165165
...
166166
/* establishing connection to redis is outside of bredis */
167167
asio::ip::tcp::endpoint end_point(
168-
asio::ip::address::from_string("127.0.0.1"), port);
168+
asio::ip::make_address("127.0.0.1"), port);
169169
socket_t socket(io_service, end_point.protocol());
170170
socket.connect(end_point);
171171

@@ -234,7 +234,7 @@ using result_t = r::parse_result_mapper_t<Iterator, Policy>;
234234
...
235235
/* establishing the connection to redis is outside of bredis */
236236
asio::ip::tcp::endpoint end_point(
237-
asio::ip::address::from_string("127.0.0.1"), port);
237+
asio::ip::make_address("127.0.0.1"), port);
238238
socket_t socket(io_service, end_point.protocol());
239239
socket.connect(end_point);
240240
...
@@ -467,7 +467,7 @@ outside of the bredis connection.
467467
using socket_t = asio::ip::tcp::socket;
468468
using next_layer_t = socket_t &;
469469
...
470-
asio::ip::tcp::endpoint end_point(asio::ip::address::from_string("127.0.0.1"), port);
470+
asio::ip::tcp::endpoint end_point(asio::ip::make_address("127.0.0.1"), port);
471471
socket_t socket(io_service, end_point.protocol());
472472
socket.connect(end_point);
473473
r::Connection<next_layer_t> c(socket);

examples/multi-threads-1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ int main(int argc, char **argv) {
138138
uint16_t port = vm.count("host") ? vm["port"].as<std::uint16_t>() : 6379;
139139

140140
asio::io_context io;
141-
//asio::io_service io_service;
142-
auto ip_address = asio::ip::address::from_string(host);
141+
//asio::io_context io_service;
142+
auto ip_address = asio::ip::make_address(host);
143143
std::cout << "connecting to " << host << ":" << port << "\n";
144144
asio::ip::tcp::endpoint end_point(ip_address, port);
145145
socket_t socket(io, end_point.protocol());

examples/speed_test_async_multi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ int main(int argc, char **argv) {
9191

9292
r::command_wrapper_t cmd_wpapper{std::move(cmd_container)};
9393

94-
asio::io_service io_service;
95-
auto ip_address = asio::ip::address::from_string(dst_parts[0]);
94+
asio::io_context io_service;
95+
auto ip_address = asio::ip::make_address(dst_parts[0]);
9696
auto port = boost::lexical_cast<std::uint16_t>(dst_parts[1]);
9797
std::cout << "connecting to " << address << "\n";
9898
asio::ip::tcp::endpoint end_point(ip_address, port);

examples/stream-parse.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ int main(int argc, char **argv) {
113113
std::copy(&argv[2], &argv[argc], std::back_inserter(cmd_items));
114114

115115
// connect to redis
116-
asio::io_service io_service;
117-
auto ip_address = asio::ip::address::from_string(dst_parts[0]);
116+
asio::io_context io_service;
117+
auto ip_address = asio::ip::make_address(dst_parts[0]);
118118
auto port = boost::lexical_cast<std::uint16_t>(dst_parts[1]);
119119
std::cout << "connecting to " << address << "\n";
120120
asio::ip::tcp::endpoint end_point(ip_address, port);

examples/synch-subscription.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ int main(int argc, char **argv) {
111111

112112
try {
113113
// connect to redis
114-
asio::io_service io_service;
115-
auto ip_address = asio::ip::address::from_string(dst_parts[0]);
114+
asio::io_context io_service;
115+
auto ip_address = asio::ip::make_address(dst_parts[0]);
116116
auto port = boost::lexical_cast<std::uint16_t>(dst_parts[1]);
117117
std::cout << "connecting to " << address << "\n";
118118
asio::ip::tcp::endpoint end_point(ip_address, port);

include/bredis/impl/async_op.ipp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,14 @@ class async_read_op {
176176
return asio_handler_is_continuation(std::addressof(op->callback_));
177177
}
178178

179-
friend void *asio_handler_allocate(std::size_t size, async_read_op *op) {
180-
using boost::asio::asio_handler_allocate;
181-
return asio_handler_allocate(size, std::addressof(op->callback_));
179+
boost::asio::associated_allocator_t<ReadCallback> get_allocator() const noexcept
180+
{
181+
return boost::asio::get_associated_allocator(callback_);
182182
}
183183

184-
friend void asio_handler_deallocate(void *p, std::size_t size,
185-
async_read_op *op) {
186-
using boost::asio::asio_handler_deallocate;
187-
return asio_handler_deallocate(p, size, std::addressof(op->callback_));
188-
}
189-
190-
template <class Function>
191-
friend void asio_handler_invoke(Function &&f, async_read_op *op) {
192-
using boost::asio::asio_handler_invoke;
193-
return asio_handler_invoke(f, std::addressof(op->callback_));
184+
boost::asio::associated_executor_t<ReadCallback> get_executor() const noexcept
185+
{
186+
return boost::asio::get_associated_executor(callback_);
194187
}
195188
};
196189

t/05-protocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace r = bredis;
1010
namespace asio = boost::asio;
1111

12-
using Buffer = asio::const_buffers_1;
12+
using Buffer = asio::const_buffer;
1313
using Iterator = boost::asio::buffers_iterator<Buffer, char>;
1414
using Policy = r::parsing_policy::keep_result;
1515
using positive_result_t = r::parse_result_mapper_t<Iterator, Policy>;

t/06-fragmented-buffer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace r = bredis;
1212
namespace asio = boost::asio;
1313

1414
TEST_CASE("right consumption", "[protocol]") {
15-
using Buffer = std::vector<asio::const_buffers_1>;
15+
using Buffer = std::vector<asio::const_buffer>;
1616
using Iterator = boost::asio::buffers_iterator<Buffer, char>;
1717
using Policy = r::parsing_policy::keep_result;
1818
using positive_result_t = r::parse_result_mapper_t<Iterator, Policy>;
@@ -22,7 +22,7 @@ TEST_CASE("right consumption", "[protocol]") {
2222

2323
Buffer buff;
2424
for (size_t i = 0; i < full_message.size(); i++) {
25-
asio::const_buffers_1 v(full_message.c_str() + i, 1);
25+
asio::const_buffer v(full_message.c_str() + i, 1);
2626
buff.push_back(v);
2727
}
2828
auto b_from = Iterator::begin(buff), b_to = Iterator::end(buff);

t/07-extract.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace r = bredis;
99
namespace asio = boost::asio;
1010

11-
using Buffer = asio::const_buffers_1;
11+
using Buffer = asio::const_buffer;
1212
using Iterator = boost::asio::buffers_iterator<Buffer, char>;
1313

1414
TEST_CASE("string extraction", "[protocol]") {

0 commit comments

Comments
 (0)