]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/net: return bool from Connection::is_connected()
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 26 Aug 2019 03:14:48 +0000 (11:14 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 28 Aug 2019 01:17:57 +0000 (09:17 +0800)
There's no need to return a futurized bool from is_connected() if we are
holding ConnectionRef from the same core. Also add the missing const
qualifier.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/Connection.h
src/crimson/net/SocketConnection.cc
src/crimson/net/SocketConnection.h

index 0f8fb12204dfe8843cd32a6bbcf8301bf9371d81..328aca570d52808fdc1ab1f344271fd4b29a1ef0 100644 (file)
@@ -57,7 +57,7 @@ class Connection : public seastar::enable_shared_from_this<Connection> {
   bool peer_is_client() const { return peer_name.is_client(); }
 
   /// true if the handshake has completed and no errors have been encountered
-  virtual seastar::future<bool> is_connected() = 0;
+  virtual bool is_connected() const = 0;
 
   /// send a message over a connection that has completed its handshake
   virtual seastar::future<> send(MessageRef msg) = 0;
index bb66a3e524a1d05c142786f1dda3aa071138174e..452754b3a5532e6618202d5a3abe02453b8ca3d3 100644 (file)
@@ -41,11 +41,10 @@ SocketConnection::get_messenger() const {
   return &messenger;
 }
 
-seastar::future<bool> SocketConnection::is_connected()
+bool SocketConnection::is_connected() const
 {
-  return seastar::smp::submit_to(shard_id(), [this] {
-      return protocol->is_connected();
-    });
+  ceph_assert(seastar::engine().cpu_id() == shard_id());
+  return protocol->is_connected();
 }
 
 seastar::future<> SocketConnection::send(MessageRef msg)
index a8c4942ed0e626e996b9c5f7dbd6e24d47cda8fe..183fc81d94a036fb2bdc2dc1da887ec27ddd3083 100644 (file)
@@ -79,7 +79,7 @@ class SocketConnection : public Connection {
 
   Messenger* get_messenger() const override;
 
-  seastar::future<bool> is_connected() override;
+  bool is_connected() const override;
 
   seastar::future<> send(MessageRef msg) override;