diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-04-20 15:00:45 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-04-21 14:57:44 -0400 |
commit | 516600ebbd7831b5056a989cab5c59e919b42304 (patch) | |
tree | 8db51230b9979c755d5acee2c1afdbdedfec3810 /client | |
parent | b291d96b0a536a5832bb89fb08d209128d5d5c97 (diff) | |
download | mongo-516600ebbd7831b5056a989cab5c59e919b42304.tar.gz |
ok() method on ScopedConnection to know if you actually have one or if done has been called
Diffstat (limited to 'client')
-rw-r--r-- | client/connpool.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/client/connpool.h b/client/connpool.h index a0109b638af..54d2fea5d86 100644 --- a/client/connpool.h +++ b/client/connpool.h @@ -158,9 +158,15 @@ namespace mongo { public: AScopedConnection() { _numConnections++; } virtual ~AScopedConnection() { _numConnections--; } + virtual DBClientBase* get() = 0; virtual void done() = 0; virtual string getHost() const = 0; + + /** + * @return true iff this has a connection to the db + */ + virtual bool ok() const = 0; /** * @return total number of current instances of AScopedConnection @@ -214,6 +220,8 @@ namespace mongo { return _conn; } + bool ok() const { return _conn > 0; } + string getHost() const { return _host; } /** Force closure of the connection. You should call this if you leave it in |