From: Samuel Just Date: Thu, 30 May 2019 00:32:01 +0000 (-0700) Subject: crimson/net/Connection: add peer_is_* helpers X-Git-Tag: v15.1.0~2580^2~11 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d0dbb36e2e4649d85b5c4971d5cc97d7f4c129aa;p=ceph-ci.git crimson/net/Connection: add peer_is_* helpers Signed-off-by: Samuel Just --- 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;