From 40441fecb437be413993106fdf98eca1c93a5fcc Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Mon, 7 Dec 2020 01:54:58 +1100 Subject: [PATCH] Wesnothd Connection: simplify send() implementation asio::const_buffers_1 is deprecated as of 1.66. Its replacement (const_buffer) doesn't have begin() and end() functions. However, since (unless I'm reading this code wrong), we're dealing with a single buffer at this point, we don't need the range constructor and can just insert the data directly into the queue via internalizer list (this also allows us to remove the push_front call). If we do need a range call, I think we're supposed to now use asio::buffer_sequence_begin and asio::buffer_sequence_end. --- src/wesnothd_connection.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wesnothd_connection.cpp b/src/wesnothd_connection.cpp index 1534ec75d93..3f1fd27be8b 100644 --- a/src/wesnothd_connection.cpp +++ b/src/wesnothd_connection.cpp @@ -376,10 +376,10 @@ void wesnothd_connection::send() bytes_written_ = 0; payload_size_ = htonl(buf_size); - boost::asio::streambuf::const_buffers_type gzipped_data = buf.data(); - std::deque bufs(gzipped_data.begin(), gzipped_data.end()); - - bufs.push_front(boost::asio::buffer(reinterpret_cast(&payload_size_), 4)); + std::deque bufs { + boost::asio::buffer(reinterpret_cast(&payload_size_), 4), + buf.data() + }; boost::asio::async_write(socket_, bufs, std::bind(&wesnothd_connection::is_write_complete, this, std::placeholders::_1, std::placeholders::_2),