From e57d5ac775581340fb1c22b86e7ace2f83e629b7 Mon Sep 17 00:00:00 2001 From: Bart <11445373+bthomee@users.noreply.github.com> Date: Tue, 9 Jun 2026 13:44:05 -0400 Subject: [PATCH] Review feedback --- src/xrpld/overlay/detail/PeerImp.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 7e44ae534d..97a39ae6fc 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -299,7 +299,7 @@ PeerImp::send(std::shared_ptr const& m) { // To detect a peer that does not read from their // side of the connection, we expect a peer to have - // a small senq periodically + // a small sendq periodically largeSendq_ = 0; } else if (auto sink = journal_.debug(); sink && (sendqSize % Tuning::kSendQueueLogFreq) == 0) @@ -319,10 +319,7 @@ PeerImp::send(std::shared_ptr const& m) bind_executor( strand_, std::bind( - &PeerImp::onWriteMessage, - shared_from_this(), - std::placeholders::_1, - std::placeholders::_2))); + &PeerImp::onWriteMessage, self, std::placeholders::_1, std::placeholders::_2))); }); } @@ -588,6 +585,7 @@ PeerImp::hasRange(std::uint32_t uMin, std::uint32_t uMax) void PeerImp::close() { + XRPL_ASSERT(strand_.running_in_this_thread(), "xrpl::PeerImp::close : strand in this thread"); if (!socket_.is_open()) return; @@ -617,6 +615,7 @@ PeerImp::fail(std::string const& reason) void PeerImp::fail(std::string const& name, error_code ec) { + XRPL_ASSERT(strand_.running_in_this_thread(), "xrpl::PeerImp::fail : strand in this thread"); if (!socket_.is_open()) return; @@ -628,6 +627,8 @@ PeerImp::fail(std::string const& name, error_code ec) void PeerImp::gracefulClose() { + XRPL_ASSERT( + strand_.running_in_this_thread(), "xrpl::PeerImp::gracefulClose : strand in this thread"); XRPL_ASSERT(socket_.is_open(), "xrpl::PeerImp::gracefulClose : socket is open"); XRPL_ASSERT(!gracefulClose_, "xrpl::PeerImp::gracefulClose : socket is not closing"); gracefulClose_ = true;