Make protocol version <37 compatibility a setting
This commit is contained in:
parent
feb71c65e3
commit
f8f32cc628
@ -1034,6 +1034,9 @@ port (Server port) int 30000
|
||||
# The network interface that the server listens on.
|
||||
bind_address (Bind address) string
|
||||
|
||||
# Disable to prevent clients that don't support protocol version 37 from connecting.
|
||||
enable_protocol_compat (Enable legacy network protocol compatibility) bool true
|
||||
|
||||
# Enable to disallow old clients from connecting.
|
||||
# Older clients are compatible in the sense that they will not crash when connecting
|
||||
# to new servers, but they may not support all new features that you are expecting.
|
||||
|
@ -1233,6 +1233,9 @@
|
||||
# type: string
|
||||
# bind_address =
|
||||
|
||||
# Disable to prevent clients that don't support protocol version 37 from connecting.
|
||||
# enable_proto_compat = true
|
||||
|
||||
# Enable to disallow old clients from connecting.
|
||||
# Older clients are compatible in the sense that they will not crash when connecting
|
||||
# to new servers, but they may not support all new features that you are expecting.
|
||||
|
@ -384,6 +384,7 @@ void set_default_settings()
|
||||
settings->setDefault("ipv6_server", "false");
|
||||
settings->setDefault("max_packets_per_iteration","1024");
|
||||
settings->setDefault("port", "40000");
|
||||
settings->setDefault("enable_protocol_compat", "true");
|
||||
settings->setDefault("strict_protocol_version_checking", "false");
|
||||
settings->setDefault("player_transfer_distance", "0");
|
||||
settings->setDefault("max_simultaneous_block_sends_per_client", "40");
|
||||
|
@ -212,6 +212,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
// Server's supported network protocol range
|
||||
#define SERVER_PROTOCOL_VERSION_MIN 25
|
||||
#define SERVER_PROTOCOL_VERSION_MIN_NOCOMPAT 37
|
||||
#define SERVER_PROTOCOL_VERSION_MAX LATEST_PROTOCOL_VERSION
|
||||
|
||||
// Client's supported network protocol range
|
||||
|
@ -143,9 +143,10 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
|
||||
|
||||
client->net_proto_version = net_proto_version;
|
||||
|
||||
const u16 server_proto_ver_min = g_settings->getBool("enable_protocol_compat") ? SERVER_PROTOCOL_VERSION_MIN : SERVER_PROTOCOL_VERSION_MIN_NOCOMPAT;
|
||||
if ((g_settings->getBool("strict_protocol_version_checking") &&
|
||||
net_proto_version != LATEST_PROTOCOL_VERSION) ||
|
||||
net_proto_version < SERVER_PROTOCOL_VERSION_MIN ||
|
||||
net_proto_version < server_proto_ver_min ||
|
||||
net_proto_version > SERVER_PROTOCOL_VERSION_MAX) {
|
||||
actionstream << "Server: A mismatched client tried to connect from " <<
|
||||
addr_s << " proto_max=" << (int)max_net_proto_version << std::endl;
|
||||
|
@ -71,11 +71,12 @@ void sendAnnounce(AnnounceAction action,
|
||||
}
|
||||
if (action != AA_DELETE) {
|
||||
bool strict_checking = g_settings->getBool("strict_protocol_version_checking");
|
||||
bool proto_compat = g_settings->getBool("enable_protocol_compat");
|
||||
server["name"] = g_settings->get("server_name");
|
||||
server["description"] = g_settings->get("server_description");
|
||||
server["version"] = g_version_string;
|
||||
server["server_id"] = PROJECT_NAME;
|
||||
server["proto_min"] = strict_checking ? LATEST_PROTOCOL_VERSION : SERVER_PROTOCOL_VERSION_MIN;
|
||||
server["proto_min"] = strict_checking ? LATEST_PROTOCOL_VERSION : (proto_compat ? SERVER_PROTOCOL_VERSION_MIN : SERVER_PROTOCOL_VERSION_MIN_NOCOMPAT);
|
||||
server["proto_max"] = strict_checking ? LATEST_PROTOCOL_VERSION : SERVER_PROTOCOL_VERSION_MAX;
|
||||
server["url"] = g_settings->get("server_url");
|
||||
server["creative"] = g_settings->getBool("creative_mode");
|
||||
|
Loading…
x
Reference in New Issue
Block a user