]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net/Connection: add peer_is_* helpers
authorSamuel Just <sjust@redhat.com>
Thu, 30 May 2019 00:32:01 +0000 (17:32 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 31 May 2019 21:05:44 +0000 (14:05 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/net/Connection.h

index 32b057e1080659614645e5536d416bfabe67b522..986ba437548fac5ec864cea4b4a65e5a56bab535 100644 (file)
@@ -44,6 +44,14 @@ class Connection : public seastar::enable_shared_from_this<Connection> {
   const entity_addr_t& get_peer_addr() const { return peer_addr; }
   virtual int get_peer_type() const = 0;
 
+  bool peer_is_mon() const { return get_peer_type() == CEPH_ENTITY_TYPE_MON; }
+  bool peer_is_mgr() const { return get_peer_type() == CEPH_ENTITY_TYPE_MGR; }
+  bool peer_is_mds() const { return get_peer_type() == CEPH_ENTITY_TYPE_MDS; }
+  bool peer_is_osd() const { return get_peer_type() == CEPH_ENTITY_TYPE_OSD; }
+  bool peer_is_client() const {
+    return get_peer_type() == CEPH_ENTITY_TYPE_CLIENT;
+  }
+
   /// true if the handshake has completed and no errors have been encountered
   virtual seastar::future<bool> is_connected() = 0;