summaryrefslogtreecommitdiff
path: root/src/serverlist.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-02-17 01:37:14 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2015-02-18 16:09:59 +0100
commit5a0ed780f56a5225b3d7c5f64099586e390e5f39 (patch)
tree8d027371f69fab8b3b3893841b3663d2a0411d22 /src/serverlist.cpp
parent8941ea0cc9ae899c8e43743c7a4efc7e9db9c489 (diff)
downloadminetest-5a0ed780f56a5225b3d7c5f64099586e390e5f39.tar.gz
minetest-5a0ed780f56a5225b3d7c5f64099586e390e5f39.tar.bz2
minetest-5a0ed780f56a5225b3d7c5f64099586e390e5f39.zip
Server: announce MIN/MAX protocol version supported to serverlist. Client: check serverlist
Client now informs about incompatible servers from the list, this permits to prevent the protocol movements. Server announces its supported protocol versions to master server
Diffstat (limited to 'src/serverlist.cpp')
-rw-r--r--src/serverlist.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/serverlist.cpp b/src/serverlist.cpp
index 472a6b85c..a3353340e 100644
--- a/src/serverlist.cpp
+++ b/src/serverlist.cpp
@@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h"
#include "porting.h"
#include "log.h"
+#include "network/networkprotocol.h"
#include "json/json.h"
#include "convert_json.h"
#include "httpfetch.h"
@@ -67,8 +68,11 @@ std::vector<ServerListSpec> getLocal()
std::vector<ServerListSpec> getOnline()
{
- Json::Value root = fetchJsonValue(
- (g_settings->get("serverlist_url") + "/list").c_str(), NULL);
+ std::ostringstream geturl;
+ geturl << g_settings->get("serverlist_url") <<
+ "/list?proto_version_min=" << CLIENT_PROTOCOL_VERSION_MIN <<
+ "&proto_version_max=" << CLIENT_PROTOCOL_VERSION_MAX;
+ Json::Value root = fetchJsonValue(geturl.str(), NULL);
std::vector<ServerListSpec> server_list;
@@ -205,9 +209,12 @@ void sendAnnounce(const std::string &action,
server["address"] = g_settings->get("server_address");
}
if (action != "delete") {
+ bool strict_checking = g_settings->getBool("strict_protocol_version_checking");
server["name"] = g_settings->get("server_name");
server["description"] = g_settings->get("server_description");
server["version"] = minetest_version_simple;
+ server["proto_min"] = strict_checking ? LATEST_PROTOCOL_VERSION : SERVER_PROTOCOL_VERSION_MIN;
+ 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");
server["damage"] = g_settings->getBool("enable_damage");