Fixed TS3 client
This commit is contained in:
parent
49b7a8df67
commit
37e3cfc30e
@ -70,8 +70,8 @@ tc::audio::AudioOutput* global_audio_output;
|
|||||||
Nan::Set(object, (uint32_t) value, Nan::New<v8::String>(key).ToLocalChecked());
|
Nan::Set(object, (uint32_t) value, Nan::New<v8::String>(key).ToLocalChecked());
|
||||||
|
|
||||||
NAN_MODULE_INIT(init) {
|
NAN_MODULE_INIT(init) {
|
||||||
//logger::initialize_node();
|
logger::initialize_node();
|
||||||
logger::initialize_raw();
|
//logger::initialize_raw();
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
logger::info(category::general, tr("Hello World from C. PPID: {}, PID: {}"), getppid(), getpid());
|
logger::info(category::general, tr("Hello World from C. PPID: {}, PID: {}"), getppid(), getpid());
|
||||||
|
@ -18,7 +18,6 @@ using namespace ts::protocol;
|
|||||||
using namespace ts;
|
using namespace ts;
|
||||||
|
|
||||||
ProtocolHandler::ProtocolHandler(ServerConnection* handle) : handle{handle}, packet_decoder{&this->crypt_handler, false} {
|
ProtocolHandler::ProtocolHandler(ServerConnection* handle) : handle{handle}, packet_decoder{&this->crypt_handler, false} {
|
||||||
|
|
||||||
this->packet_decoder.callback_argument = this;
|
this->packet_decoder.callback_argument = this;
|
||||||
this->packet_decoder.callback_decoded_packet = ProtocolHandler::callback_packet_decoded;
|
this->packet_decoder.callback_decoded_packet = ProtocolHandler::callback_packet_decoded;
|
||||||
this->packet_decoder.callback_decoded_command = ProtocolHandler::callback_command_decoded;
|
this->packet_decoder.callback_decoded_command = ProtocolHandler::callback_command_decoded;
|
||||||
@ -334,7 +333,7 @@ void ProtocolHandler::send_packet(ts::protocol::OutgoingClientPacket *packet, bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Since we assume that the packets gets written instantly we're setting the next ptr to null */
|
/* Since we assume that the packets gets written instantly we're setting the next ptr to null */
|
||||||
if((packet->type_and_flags_ & PacketFlag::Unencrypted) || !this->crypt_setupped) {
|
if(packet->type_and_flags_ & PacketFlag::Unencrypted) {
|
||||||
this->crypt_handler.write_default_mac(packet->mac);
|
this->crypt_handler.write_default_mac(packet->mac);
|
||||||
} else {
|
} else {
|
||||||
ts::connection::CryptHandler::key_t crypt_key{};
|
ts::connection::CryptHandler::key_t crypt_key{};
|
||||||
@ -516,7 +515,11 @@ void ProtocolHandler::send_acknowledge(uint16_t packet_id, bool low) {
|
|||||||
auto packet = protocol::allocate_outgoing_client_packet(2);
|
auto packet = protocol::allocate_outgoing_client_packet(2);
|
||||||
|
|
||||||
packet->type_and_flags_ = (uint8_t) (low ? protocol::PacketType::ACK_LOW : protocol::PacketType::ACK) |
|
packet->type_and_flags_ = (uint8_t) (low ? protocol::PacketType::ACK_LOW : protocol::PacketType::ACK) |
|
||||||
(uint8_t) (protocol::PacketFlag::Unencrypted | protocol::PacketFlag::NewProtocol);
|
(uint8_t) (protocol::PacketFlag::NewProtocol);
|
||||||
|
|
||||||
|
if(!this->crypt_setupped) {
|
||||||
|
packet->type_and_flags_ |= protocol::PacketFlag::Unencrypted;
|
||||||
|
}
|
||||||
|
|
||||||
le2be16(packet_id, packet->payload);
|
le2be16(packet_id, packet->payload);
|
||||||
this->send_packet(packet, false);
|
this->send_packet(packet, false);
|
||||||
|
@ -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->_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){
|
this->send_command(response, false, std::make_unique<std::function<void(bool)>>([&](bool success){
|
||||||
if(success) {
|
if(success) {
|
||||||
/* trigger connected; because the connection has been established on protocol layer */
|
|
||||||
this->crypt_setupped = true;
|
this->crypt_setupped = true;
|
||||||
|
/* trigger connected; because the connection has been established on protocol layer */
|
||||||
this->handle->call_connect_result.call(0, true);
|
this->handle->call_connect_result.call(0, true);
|
||||||
this->connection_state = connection_state::CONNECTING;
|
this->connection_state = connection_state::CONNECTING;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user