diff options
Diffstat (limited to 'src/mongo/db/client_basic.h')
-rw-r--r-- | src/mongo/db/client_basic.h | 81 |
1 files changed, 44 insertions, 37 deletions
diff --git a/src/mongo/db/client_basic.h b/src/mongo/db/client_basic.h index b28bf0f4c3c..6587227245b 100644 --- a/src/mongo/db/client_basic.h +++ b/src/mongo/db/client_basic.h @@ -37,49 +37,56 @@ namespace mongo { - class ServiceContext; +class ServiceContext; - /** - * this is the base class for Client and ClientInfo - * Client is for mongod - * ClientInfo is for mongos - * They should converge slowly - * The idea is this has the basic api so that not all code has to be duplicated - */ - class ClientBasic : public Decorable<ClientBasic> { - MONGO_DISALLOW_COPYING(ClientBasic); - public: - bool getIsLocalHostConnection() { - if (!hasRemote()) { - return false; - } - return getRemote().isLocalHost(); - } +/** + * this is the base class for Client and ClientInfo + * Client is for mongod + * ClientInfo is for mongos + * They should converge slowly + * The idea is this has the basic api so that not all code has to be duplicated + */ +class ClientBasic : public Decorable<ClientBasic> { + MONGO_DISALLOW_COPYING(ClientBasic); - bool hasRemote() const { return _messagingPort; } - HostAndPort getRemote() const { - verify( _messagingPort ); - return _messagingPort->remote(); +public: + bool getIsLocalHostConnection() { + if (!hasRemote()) { + return false; } + return getRemote().isLocalHost(); + } - /** - * Returns the ServiceContext that owns this client session context. - */ - ServiceContext* getServiceContext() const { return _serviceContext; } + bool hasRemote() const { + return _messagingPort; + } + HostAndPort getRemote() const { + verify(_messagingPort); + return _messagingPort->remote(); + } - /** - * Returns the AbstractMessagePort to which this client session is bound, if any. - */ - AbstractMessagingPort * port() const { return _messagingPort; } + /** + * Returns the ServiceContext that owns this client session context. + */ + ServiceContext* getServiceContext() const { + return _serviceContext; + } + + /** + * Returns the AbstractMessagePort to which this client session is bound, if any. + */ + AbstractMessagingPort* port() const { + return _messagingPort; + } - static ClientBasic* getCurrent(); + static ClientBasic* getCurrent(); - protected: - ClientBasic(ServiceContext* serviceContext, AbstractMessagingPort* messagingPort); - ~ClientBasic(); +protected: + ClientBasic(ServiceContext* serviceContext, AbstractMessagingPort* messagingPort); + ~ClientBasic(); - private: - ServiceContext* const _serviceContext; - AbstractMessagingPort* const _messagingPort; - }; +private: + ServiceContext* const _serviceContext; + AbstractMessagingPort* const _messagingPort; +}; } |