From d0dbb36e2e4649d85b5c4971d5cc97d7f4c129aa Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 29 May 2019 17:32:01 -0700 Subject: [PATCH] crimson/net/Connection: add peer_is_* helpers Signed-off-by: Samuel Just --- src/crimson/net/Connection.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/crimson/net/Connection.h b/src/crimson/net/Connection.h index 32b057e1080..986ba437548 100644 --- a/src/crimson/net/Connection.h +++ b/src/crimson/net/Connection.h @@ -44,6 +44,14 @@ class Connection : public seastar::enable_shared_from_this { 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 is_connected() = 0; -- 2.39.5