diff --git a/native/serverconnection/src/connection/Socket.cpp b/native/serverconnection/src/connection/Socket.cpp index 43a86fa..89af66b 100644 --- a/native/serverconnection/src/connection/Socket.cpp +++ b/native/serverconnection/src/connection/Socket.cpp @@ -147,7 +147,7 @@ void UDPSocket::callback_read(evutil_socket_t fd) { source_address_length = sizeof(sockaddr); read_length = recvfrom(fd, (char*) buffer, (int) buffer_length, MSG_DONTWAIT, &source_address, &source_address_length); if(read_length <= 0) { - if(errno == EAGAIN || read_length == 0) + if(errno == EAGAIN || (read_length == 0 && read_count > 0)) break; logger::warn(category::socket, tr("Failed to receive data: {}/{}"), errno, strerror(errno)); diff --git a/native/serverconnection/src/connection/audio/VoiceClient.cpp b/native/serverconnection/src/connection/audio/VoiceClient.cpp index 69cc1d3..cf793c8 100644 --- a/native/serverconnection/src/connection/audio/VoiceClient.cpp +++ b/native/serverconnection/src/connection/audio/VoiceClient.cpp @@ -227,7 +227,7 @@ VoiceClient::VoiceClient(const std::shared_ptr&, uint16_t clien this->set_state(state::buffering); } - audio::decode_event_loop->schedule(dynamic_pointer_cast(this->ref())); + audio::decode_event_loop->schedule(static_pointer_cast(this->ref())); } } @@ -368,7 +368,7 @@ void VoiceClient::process_packet(uint16_t packet_id, const pipes::buffer_view& b codec_data.process_pending = true; } - audio::decode_event_loop->schedule(dynamic_pointer_cast(this->ref())); + audio::decode_event_loop->schedule(static_pointer_cast(this->ref())); } void VoiceClient::cancel_replay() { @@ -376,7 +376,7 @@ void VoiceClient::cancel_replay() { this->output_source->clear(); this->set_state(state::stopped); - audio::decode_event_loop->cancel(dynamic_pointer_cast(this->ref())); + audio::decode_event_loop->cancel(static_pointer_cast(this->ref())); auto execute_lock = this->execute_lock(true); for(auto& codec : this->codec) { @@ -549,7 +549,7 @@ void VoiceClient::event_execute(const std::chrono::system_clock::time_point &sch if(reschedule) { log_warn(category::voice_connection, tr("Audio data decode will take longer than {} us. Enqueueing for later"), chrono::duration_cast(max_time).count()); - audio::decode_event_loop->schedule(dynamic_pointer_cast(this->ref())); + audio::decode_event_loop->schedule(static_pointer_cast(this->ref())); } } diff --git a/native/serverconnection/src/connection/audio/VoiceClient.h b/native/serverconnection/src/connection/audio/VoiceClient.h index e721f7d..979c0e5 100644 --- a/native/serverconnection/src/connection/audio/VoiceClient.h +++ b/native/serverconnection/src/connection/audio/VoiceClient.h @@ -48,9 +48,15 @@ namespace tc { class VoiceClient : private event::EventEntry { friend class VoiceConnection; - + +#ifdef WIN32 + template + friend _NODISCARD std::shared_ptr<_Tp> std::static_pointer_cast(std::shared_ptr<_Up>&& _Other) noexcept; +#else template friend inline std::shared_ptr<_Tp> std::static_pointer_cast(const std::shared_ptr<_Up>& __r) noexcept; +#endif + //_NODISCARD shared_ptr<_Ty1> static_pointer_cast(shared_ptr<_Ty2>&& _Other) noexcept public: struct state { enum value { diff --git a/package.json b/package.json index af84e66..03e0644 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "TeaClient", - "version": "1.4.2-4", + "version": "1.4.2-5", "description": "", "main": "main.js", "scripts": {