mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Finalize init packets and enable protocol v25
This enables srp.
This commit is contained in:
parent
19cbb6b37b
commit
8dbf683313
6 changed files with 38 additions and 28 deletions
|
@ -91,22 +91,22 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
|
|||
// First byte after command is maximum supported
|
||||
// serialization version
|
||||
u8 client_max;
|
||||
u8 compression_modes;
|
||||
u16 supp_compr_modes;
|
||||
u16 min_net_proto_version = 0;
|
||||
u16 max_net_proto_version;
|
||||
std::string playerName;
|
||||
|
||||
*pkt >> client_max >> compression_modes >> min_net_proto_version
|
||||
*pkt >> client_max >> supp_compr_modes >> min_net_proto_version
|
||||
>> max_net_proto_version >> playerName;
|
||||
|
||||
u8 our_max = SER_FMT_VER_HIGHEST_READ;
|
||||
// Use the highest version supported by both
|
||||
u8 deployed = std::min(client_max, our_max);
|
||||
u8 depl_serial_v = std::min(client_max, our_max);
|
||||
// If it's lower than the lowest supported, give up.
|
||||
if (deployed < SER_FMT_VER_LOWEST)
|
||||
deployed = SER_FMT_VER_INVALID;
|
||||
if (depl_serial_v < SER_FMT_VER_LOWEST)
|
||||
depl_serial_v = SER_FMT_VER_INVALID;
|
||||
|
||||
if (deployed == SER_FMT_VER_INVALID) {
|
||||
if (depl_serial_v == SER_FMT_VER_INVALID) {
|
||||
actionstream << "Server: A mismatched client tried to connect from "
|
||||
<< addr_s << std::endl;
|
||||
infostream<<"Server: Cannot negotiate serialization version with "
|
||||
|
@ -115,7 +115,7 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
|
|||
return;
|
||||
}
|
||||
|
||||
client->setPendingSerializationVersion(deployed);
|
||||
client->setPendingSerializationVersion(depl_serial_v);
|
||||
|
||||
/*
|
||||
Read and check network protocol version
|
||||
|
@ -274,7 +274,9 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
|
|||
NetworkPacket resp_pkt(TOCLIENT_HELLO, 1 + 4
|
||||
+ legacyPlayerNameCasing.size(), pkt->getPeerId());
|
||||
|
||||
resp_pkt << deployed << auth_mechs << legacyPlayerNameCasing;
|
||||
u16 depl_compress_mode = NETPROTO_COMPRESSION_NONE;
|
||||
resp_pkt << depl_serial_v << depl_compress_mode << net_proto_version
|
||||
<< auth_mechs << legacyPlayerNameCasing;
|
||||
|
||||
Send(&resp_pkt);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue