From: Amnon Hanuhov Date: Thu, 8 Apr 2021 14:10:25 +0000 (+0300) Subject: crimson/net: Overload conn::send() method to take unique_ptr X-Git-Tag: v17.1.0~2024^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1f6e66470504fe5aec4cae3fc74d6e9927aae7aa;p=ceph.git crimson/net: Overload conn::send() method to take unique_ptr Signed-off-by: Amnon Hanuhov --- diff --git a/src/crimson/net/Connection.h b/src/crimson/net/Connection.h index 6af12692e78..4e10dded230 100644 --- a/src/crimson/net/Connection.h +++ b/src/crimson/net/Connection.h @@ -126,6 +126,8 @@ class Connection : public seastar::enable_shared_from_this { #endif /// send a message over a connection that has completed its handshake + virtual seastar::future<> send(MessageURef msg) = 0; + // The version with MessageRef will be dropped in the future virtual seastar::future<> send(MessageRef msg) = 0; /// send a keepalive message over a connection that has completed its diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index 0c734409252..97fc76b7304 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -69,6 +69,12 @@ bool SocketConnection::peer_wins() const return (messenger.get_myaddr() > peer_addr || policy.server); } +seastar::future<> SocketConnection::send(MessageURef msg) +{ + assert(seastar::this_shard_id() == shard_id()); + return protocol->send(MessageRef{msg.release()}); +} + seastar::future<> SocketConnection::send(MessageRef msg) { assert(seastar::this_shard_id() == shard_id()); diff --git a/src/crimson/net/SocketConnection.h b/src/crimson/net/SocketConnection.h index bb38750424f..28a2491895e 100644 --- a/src/crimson/net/SocketConnection.h +++ b/src/crimson/net/SocketConnection.h @@ -70,6 +70,7 @@ class SocketConnection : public Connection { bool peer_wins() const; #endif + seastar::future<> send(MessageURef msg) override; seastar::future<> send(MessageRef msg) override; seastar::future<> keepalive() override;