Permanently encrypting ack packets to keep compatibility with TS3

This commit is contained in:
WolverinDEV 2021-02-15 20:02:27 +01:00
parent 2c37861acd
commit ee1269e375
2 changed files with 4 additions and 5 deletions

View File

@ -308,7 +308,6 @@ void ProtocolHandler::callback_command_decoded(void *ptr_this, ts::command::Reas
void ProtocolHandler::callback_send_acknowledge(void *ptr_this, uint16_t packet_id, bool low) {
auto connection = reinterpret_cast<ProtocolHandler*>(ptr_this);
log_warn(category::connection, tr("Sending ack for {}"), packet_id);
connection->send_acknowledge(packet_id, low);
}
@ -517,9 +516,9 @@ void ProtocolHandler::send_acknowledge(uint16_t packet_id, bool low) {
packet->type_and_flags_ = (uint8_t) (low ? protocol::PacketType::ACK_LOW : protocol::PacketType::ACK) |
(uint8_t) (protocol::PacketFlag::NewProtocol);
if(!this->crypt_setupped) {
packet->type_and_flags_ |= protocol::PacketFlag::Unencrypted;
}
//if(!this->crypt_setupped) {
// packet->type_and_flags_ |= protocol::PacketFlag::Unencrypted;
//}
le2be16(packet_id, packet->payload);
this->send_packet(packet, false);

View File

@ -204,8 +204,8 @@ void ProtocolHandler::handleCommandInitIVExpend2(ts::Command &cmd) {
//this->_packet_id_manager.nextPacketId(PacketTypeInfo::Command); /* skip the first because we've send our first command within the low level handshake packets */
this->send_command(response, false, std::make_unique<std::function<void(bool)>>([&](bool success){
if(success) {
this->crypt_setupped = true;
/* trigger connected; because the connection has been established on protocol layer */
this->crypt_setupped = true;
this->handle->call_connect_result.call(0, true);
this->connection_state = connection_state::CONNECTING;
}