net: replace deprecated boost::asio::strand::wrap with bind_executor
What changed, and why it matters
This is a routine code modernization change. It replaces an older, deprecated Boost networking function called strand.wrap with the newer equivalent bind_executor in two files. There is no indication this fixes a security bug; it simply keeps the code compatible with newer versions of the Boost library.
No security action required. Treat as normal maintenance/refactoring. Continue standard dependency update and regression testing.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit swaps boost::asio::strand::wrap(…) for boost::asio::bind_executor(strand, …) in two call sites: an SSL async handshake and two steady_timer async_wait calls in the Monero P2P notification code. strand::wrap was deprecated in Boost.Asio in favor of bind_executor. The functional behavior—binding a completion handler to run on a specific strand/executor—remains the same. No logic, synchronization, or security boundary changes are visible in the diff.
Changed components
contrib/epee/src/net_ssl.cppsrc/cryptonote_protocol/levin_notify.cppInspect captured patch +5 / −5
diff --git a/contrib/epee/src/net_ssl.cpp b/contrib/epee/src/net_ssl.cpp
index e7d6eb8..74d599d 100644
--- a/contrib/epee/src/net_ssl.cpp
+++ b/contrib/epee/src/net_ssl.cpp
@@ -37,6 +37,7 @@
#include <boost/asio/strand.hpp>
#include <condition_variable>
#include <boost/lambda/lambda.hpp>
+#include <boost/asio/bind_executor.hpp>
#include <openssl/ssl.h>
#include <openssl/pem.h>
#include "misc_log_ex.h"
@@ -615,7 +616,7 @@ bool ssl_options_t::handshake(
socket.async_handshake(
type,
boost::asio::buffer(buffer),
- strand.wrap(on_handshake)
+ boost::asio::bind_executor(strand, on_handshake)
);
}
);
diff --git a/src/cryptonote_protocol/levin_notify.cpp b/src/cryptonote_protocol/levin_notify.cpp
index f87cf9c..db89f5b 100644
--- a/src/cryptonote_protocol/levin_notify.cpp
+++ b/src/cryptonote_protocol/levin_notify.cpp
@@ -33,6 +33,7 @@
#include <boost/asio/steady_timer.hpp>
#include <boost/system/system_error.hpp>
#include <boost/uuid/uuid_io.hpp>
+#include <boost/asio/bind_executor.hpp>
#include <chrono>
#include <deque>
#include <stdexcept>
@@ -354,7 +355,7 @@ namespace levin
detail::zone& this_zone = *zone;
++this_zone.flush_callbacks;
this_zone.flush_txs.expires_at(flush_time);
- this_zone.flush_txs.async_wait(this_zone.strand.wrap(fluff_flush{std::move(zone)}));
+ this_zone.flush_txs.async_wait(boost::asio::bind_executor(this_zone.strand, fluff_flush{std::move(zone)}));
}
void operator()(const boost::system::error_code error)
@@ -628,9 +629,7 @@ namespace levin
noise_channel& channel = zone->channels.at(index);
channel.next_noise.expires_at(start + noise_min_delay + random_duration(noise_delay_range));
- channel.next_noise.async_wait(
- channel.strand.wrap(send_noise{std::move(zone), index, core})
- );
+ channel.next_noise.async_wait(boost::asio::bind_executor(channel.strand, send_noise{std::move(zone), index, core}));
}
//! \pre Called within `zone_->channels[channel_].strand`.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.