@@ -69,6 +69,7 @@ typedef int socket_t;
69
69
70
70
const char * adv_multicast_addr = " 224.1.1.1" ;
71
71
const static unsigned short int adv_port = 29998 ;
72
+ const char * proto = " Luanti" ;
72
73
static std::string ask_str;
73
74
74
75
bool use_ipv6 = true ;
@@ -84,6 +85,7 @@ void lan_adv::ask()
84
85
if (ask_str.empty ()) {
85
86
Json::Value j;
86
87
j[" cmd" ] = " ask" ;
88
+ j[" proto" ] = proto;
87
89
ask_str = fastWriteJson (j);
88
90
}
89
91
@@ -258,6 +260,7 @@ void *lan_adv::run()
258
260
server[" port" ] = server_port;
259
261
server[" clients" ] = clients_num.load ();
260
262
server[" clients_max" ] = g_settings->getU16 (" max_users" );
263
+ server[" proto" ] = proto;
261
264
262
265
send_string (fastWriteJson (server));
263
266
}
@@ -280,7 +283,7 @@ void *lan_adv::run()
280
283
if (server_port) {
281
284
if (p[" cmd" ] == " ask" && limiter[addr_str] < now) {
282
285
(clients_num.load () ? infostream : actionstream)
283
- << " lan: want play " << addr_str << std::endl;
286
+ << " lan: want play " << addr_str << " " << p[ " proto " ] << std::endl;
284
287
285
288
server[" clients" ] = clients_num.load ();
286
289
answer_str = fastWriteJson (server);
@@ -292,7 +295,7 @@ void *lan_adv::run()
292
295
}
293
296
} else {
294
297
if (p[" cmd" ] == " ask" ) {
295
- actionstream << " lan: want play " << addr_str << std::endl;
298
+ actionstream << " lan: want play " << addr_str << " " << p[ " proto " ] << std::endl;
296
299
}
297
300
if (p[" port" ].isInt ()) {
298
301
p[" address" ] = addr_str;
@@ -302,7 +305,7 @@ void *lan_adv::run()
302
305
// infostream << "server shutdown " << key << "\n";
303
306
collected.erase (key);
304
307
fresh = true ;
305
- } else {
308
+ } else if (p[ " proto " ] == proto) {
306
309
if (!collected.count (key))
307
310
actionstream << " lan server start " << key << " \n " ;
308
311
collected.insert_or_assign (key, p);
0 commit comments