summaryrefslogtreecommitdiff
path: root/src/mongo/client/dbclientinterface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/client/dbclientinterface.h')
-rw-r--r--src/mongo/client/dbclientinterface.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h
index 86848f9ed93..457839a9fba 100644
--- a/src/mongo/client/dbclientinterface.h
+++ b/src/mongo/client/dbclientinterface.h
@@ -45,8 +45,9 @@
#include "mongo/rpc/unique_message.h"
#include "mongo/stdx/functional.h"
#include "mongo/transport/message_compressor_manager.h"
+#include "mongo/transport/session.h"
+#include "mongo/transport/transport_layer.h"
#include "mongo/util/mongoutils/str.h"
-#include "mongo/util/net/abstract_message_port.h"
#include "mongo/util/net/message.h"
#include "mongo/util/net/op_msg.h"
@@ -969,9 +970,11 @@ public:
return _failed;
}
- bool isStillConnected() {
- return _port ? _port->isStillConnected() : true;
- }
+ bool isStillConnected();
+
+ void setTags(transport::Session::TagMask tag);
+
+ void shutdown();
void setWireVersions(int minWireVersion, int maxWireVersion) {
_minWireVersion = minWireVersion;
@@ -986,11 +989,6 @@ public:
return _maxWireVersion;
}
- AbstractMessagingPort& port() {
- verify(_port);
- return *_port;
- }
-
std::string toString() const {
std::stringstream ss;
ss << _serverAddress;
@@ -1020,7 +1018,7 @@ public:
}
void setSoTimeout(double timeout);
double getSoTimeout() const {
- return _so_timeout;
+ return _socketTimeout.value_or(Milliseconds{0}).count() / 1000.0;
}
virtual bool lazySupported() const {
@@ -1037,7 +1035,7 @@ public:
*/
void setParentReplSetName(const std::string& replSetName);
- uint64_t getSockCreationMicroSec() const;
+ uint64_t getSockCreationMicroSec() const override;
MessageCompressorManager& getCompressorManager() {
return _compressorManager;
@@ -1065,9 +1063,13 @@ protected:
virtual void _auth(const BSONObj& params);
- std::unique_ptr<AbstractMessagingPort> _port;
+ transport::SessionHandle _session;
+ boost::optional<Milliseconds> _socketTimeout;
+ transport::Session::TagMask _tagMask = transport::Session::kEmptyTagMask;
+ uint64_t _sessionCreationMicros = INVALID_SOCK_CREATION_TIME;
+ Date_t _lastConnectivityCheck;
- bool _failed;
+ bool _failed = false;
const bool autoReconnect;
Backoff autoReconnectBackoff;
@@ -1078,7 +1080,6 @@ protected:
void _checkConnection();
std::map<std::string, BSONObj> authCache;
- double _so_timeout;
static AtomicInt32 _numConnections;
@@ -1089,6 +1090,8 @@ private:
* returned.
*/
void handleNotMasterResponse(const BSONObj& replyBody, StringData errorMsgFieldName);
+ enum FailAction { kSetFlag, kEndSession, kReleaseSession };
+ void _markFailed(FailAction action);
// Contains the string for the replica set name of the host this is connected to.
// Should be empty if this connection is not pointing to a replica set member.