BoostAsycStream wrapper over stream for boost::beast. Pass callbacks by move

This commit is contained in:
orignal
2026-07-20 15:46:00 -04:00
parent 635b013a61
commit 4f2bfb6bf7
2 changed files with 69 additions and 11 deletions
+2 -2
View File
@@ -934,11 +934,11 @@ namespace stream
return len;
}
void Stream::AsyncSend (const uint8_t * buf, size_t len, SendHandler handler)
void Stream::AsyncSend (const uint8_t * buf, size_t len, SendHandler&& handler)
{
std::shared_ptr<i2p::stream::SendBuffer> buffer;
if (len > 0 && buf)
buffer = std::make_shared<i2p::stream::SendBuffer>(buf, len, handler);
buffer = std::make_shared<i2p::stream::SendBuffer>(buf, len, std::move (handler));
else if (handler)
handler(boost::system::error_code ());
auto s = shared_from_this ();