summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/db.cpp8
-rw-r--r--src/mongo/db/dbdirectclient.cpp4
-rw-r--r--src/mongo/db/repl/replication_info.cpp4
-rw-r--r--src/mongo/db/s/set_shard_version_command.cpp4
-rw-r--r--src/mongo/db/wire_version.h38
5 files changed, 36 insertions, 22 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index c10f85b94c4..57d0c52a840 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -468,11 +468,11 @@ static void repairDatabasesAndCheckVersion(OperationContext* txn) {
static void _initWireSpec() {
WireSpec& spec = WireSpec::instance();
// accept from any version
- spec.minWireVersionIncoming = RELEASE_2_4_AND_BEFORE;
- spec.maxWireVersionIncoming = COMMANDS_ACCEPT_WRITE_CONCERN;
+ spec.incoming.minWireVersion = RELEASE_2_4_AND_BEFORE;
+ spec.incoming.maxWireVersion = COMMANDS_ACCEPT_WRITE_CONCERN;
// connect to any version
- spec.minWireVersionOutgoing = RELEASE_2_4_AND_BEFORE;
- spec.maxWireVersionOutgoing = COMMANDS_ACCEPT_WRITE_CONCERN;
+ spec.outgoing.minWireVersion = RELEASE_2_4_AND_BEFORE;
+ spec.outgoing.maxWireVersion = COMMANDS_ACCEPT_WRITE_CONCERN;
}
diff --git a/src/mongo/db/dbdirectclient.cpp b/src/mongo/db/dbdirectclient.cpp
index 06c06991722..f4bf62ed644 100644
--- a/src/mongo/db/dbdirectclient.cpp
+++ b/src/mongo/db/dbdirectclient.cpp
@@ -89,12 +89,12 @@ std::string DBDirectClient::getServerAddress() const {
// Returned version should match the incoming connections restrictions.
int DBDirectClient::getMinWireVersion() {
- return WireSpec::instance().minWireVersionIncoming;
+ return WireSpec::instance().incoming.minWireVersion;
}
// Returned version should match the incoming connections restrictions.
int DBDirectClient::getMaxWireVersion() {
- return WireSpec::instance().maxWireVersionIncoming;
+ return WireSpec::instance().incoming.maxWireVersion;
}
ConnectionString::ConnectionType DBDirectClient::type() const {
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp
index 90dd3fb451a..d27257a8eb0 100644
--- a/src/mongo/db/repl/replication_info.cpp
+++ b/src/mongo/db/repl/replication_info.cpp
@@ -286,8 +286,8 @@ public:
result.appendNumber("maxMessageSizeBytes", MaxMessageSizeBytes);
result.appendNumber("maxWriteBatchSize", BatchedCommandRequest::kMaxWriteBatchSize);
result.appendDate("localTime", jsTime());
- result.append("maxWireVersion", WireSpec::instance().maxWireVersionIncoming);
- result.append("minWireVersion", WireSpec::instance().minWireVersionIncoming);
+ result.append("maxWireVersion", WireSpec::instance().incoming.maxWireVersion);
+ result.append("minWireVersion", WireSpec::instance().incoming.minWireVersion);
result.append("readOnly", storageGlobalParams.readOnly);
const auto parameter = mapFindWithDefault(ServerParameterSet::getGlobal()->getMap(),
diff --git a/src/mongo/db/s/set_shard_version_command.cpp b/src/mongo/db/s/set_shard_version_command.cpp
index b19e72c9489..de56695a4cb 100644
--- a/src/mongo/db/s/set_shard_version_command.cpp
+++ b/src/mongo/db/s/set_shard_version_command.cpp
@@ -148,8 +148,8 @@ public:
// TODO: SERVER-21397 remove post v3.3.
// Send back wire version to let mongos know what protocol we can speak
- result.append("minWireVersion", WireSpec::instance().minWireVersionIncoming);
- result.append("maxWireVersion", WireSpec::instance().maxWireVersionIncoming);
+ result.append("minWireVersion", WireSpec::instance().incoming.minWireVersion);
+ result.append("maxWireVersion", WireSpec::instance().incoming.maxWireVersion);
return true;
}
diff --git a/src/mongo/db/wire_version.h b/src/mongo/db/wire_version.h
index 86f629e0ca7..de816c0ae1b 100644
--- a/src/mongo/db/wire_version.h
+++ b/src/mongo/db/wire_version.h
@@ -26,6 +26,10 @@
* it in the license file.
*/
+#pragma once
+
+#include "mongo/base/disallow_copying.h"
+
namespace mongo {
/**
@@ -63,6 +67,14 @@ enum WireVersion {
COMMANDS_ACCEPT_WRITE_CONCERN = 5,
};
+/**
+ * Struct to pass around information about wire version.
+ */
+struct WireVersionInfo {
+ int minWireVersion;
+ int maxWireVersion;
+};
+
struct WireSpec {
MONGO_DISALLOW_COPYING(WireSpec);
@@ -71,18 +83,20 @@ struct WireSpec {
return instance;
}
- // Minimum version that the server accepts on incoming requests. We should bump this whenever
- // we don't want to allow incoming connections from clients that are too old.
- int minWireVersionIncoming;
- // Latest version that the server accepts on incoming requests. This should always be at the
- // latest entry in WireVersion.
- int maxWireVersionIncoming;
-
- // Minimum version allowed on remote nodes when the server sends requests. We should bump this
- // whenever we don't want to connect to clients that are too old.
- int minWireVersionOutgoing;
- // Latest version allowed on remote nodes when the server sends requests.
- int maxWireVersionOutgoing;
+ // incoming.minWireVersion - Minimum version that the server accepts on incoming requests. We
+ // should bump this whenever we don't want to allow incoming connections from clients that are
+ // too old.
+
+ // incoming.maxWireVersion - Latest version that the server accepts on incoming requests. This
+ // should always be at the latest entry in WireVersion.
+ WireVersionInfo incoming;
+
+ // outgoing.minWireVersion - Minimum version allowed on remote nodes when the server sends
+ // requests. We should bump this whenever we don't want to connect to clients that are too old.
+
+ // outgoing.maxWireVersion - Latest version allowed on remote nodes when the server sends
+ // requests.
+ WireVersionInfo outgoing;
private:
WireSpec() = default;