Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

comments

  • Loading branch information...
commit 681a993dd1c00f8f327267af2e875e005f396a47 1 parent 2884252
Dwight Merriman dwight authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 client/connpool.h
12 client/connpool.h
View
@@ -141,18 +141,22 @@ namespace mongo {
};
/** Use to get a connection from the pool. On exceptions things
- clean up nicely.
+ clean up nicely (i.e. the socket gets closed automatically when the
+ scopeddbconnection goes out of scope).
*/
class ScopedDbConnection : public AScopedConnection {
public:
+ /** the main constructor you want to use
+ throws UserException if can't connect
+ */
+ explicit ScopedDbConnection(const string& host) : _host(host), _conn( pool.get(host) ) {}
+
ScopedDbConnection() : _host( "" ) , _conn(0) {}
+ /* @param conn - bind to an existing connection */
ScopedDbConnection(const string& host, DBClientBase* conn ) : _host( host ) , _conn( conn ) {}
/** throws UserException if can't connect */
- explicit ScopedDbConnection(const string& host) : _host(host), _conn( pool.get(host) ) {}
-
- /** throws UserException if can't connect */
explicit ScopedDbConnection(const ConnectionString& url ) : _host(url.toString()), _conn( pool.get(url) ) {}
/** throws UserException if can't connect */
Please sign in to comment.
Something went wrong with that request. Please try again.