mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-22 07:41:17 +08:00
[feat] use SendReliableDataFrame() instead of SendDataFrame()
This commit is contained in:
@@ -1341,8 +1341,8 @@ void Render::MainLoop() {
|
|||||||
remote_action.i.host_name_size = host_name.size();
|
remote_action.i.host_name_size = host_name.size();
|
||||||
|
|
||||||
std::string msg = remote_action.to_json();
|
std::string msg = remote_action.to_json();
|
||||||
int ret = SendDataFrame(peer_, msg.data(), msg.size(),
|
int ret = SendReliableDataFrame(peer_, msg.data(), msg.size(),
|
||||||
data_label_.c_str(), false);
|
data_label_.c_str());
|
||||||
FreeRemoteAction(remote_action);
|
FreeRemoteAction(remote_action);
|
||||||
if (0 == ret) {
|
if (0 == ret) {
|
||||||
need_to_send_host_info_ = false;
|
need_to_send_host_info_ = false;
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ int Render::SendKeyCommand(int key_code, bool is_down) {
|
|||||||
if (props->connection_status_ == ConnectionStatus::Connected) {
|
if (props->connection_status_ == ConnectionStatus::Connected) {
|
||||||
std::string msg = remote_action.to_json();
|
std::string msg = remote_action.to_json();
|
||||||
if (props->peer_) {
|
if (props->peer_) {
|
||||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||||
props->data_label_.c_str(), false);
|
props->data_label_.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,8 +104,8 @@ int Render::ProcessMouseEvent(const SDL_Event& event) {
|
|||||||
|
|
||||||
std::string msg = remote_action.to_json();
|
std::string msg = remote_action.to_json();
|
||||||
if (props->peer_) {
|
if (props->peer_) {
|
||||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||||
props->data_label_.c_str(), false);
|
props->data_label_.c_str());
|
||||||
}
|
}
|
||||||
} else if (SDL_EVENT_MOUSE_WHEEL == event.type &&
|
} else if (SDL_EVENT_MOUSE_WHEEL == event.type &&
|
||||||
last_mouse_event.button.x >= props->stream_render_rect_.x &&
|
last_mouse_event.button.x >= props->stream_render_rect_.x &&
|
||||||
@@ -151,8 +151,8 @@ int Render::ProcessMouseEvent(const SDL_Event& event) {
|
|||||||
|
|
||||||
std::string msg = remote_action.to_json();
|
std::string msg = remote_action.to_json();
|
||||||
if (props->peer_) {
|
if (props->peer_) {
|
||||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||||
props->data_label_.c_str(), false);
|
props->data_label_.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,12 +495,12 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, const char* user_id,
|
|||||||
render->need_to_send_host_info_ = true;
|
render->need_to_send_host_info_ = true;
|
||||||
render->start_screen_capturer_ = true;
|
render->start_screen_capturer_ = true;
|
||||||
render->start_speaker_capturer_ = true;
|
render->start_speaker_capturer_ = true;
|
||||||
#ifdef CROSSDESK_DEBUG
|
// #ifdef CROSSDESK_DEBUG
|
||||||
render->start_mouse_controller_ = false;
|
render->start_mouse_controller_ = false;
|
||||||
render->start_keyboard_capturer_ = false;
|
render->start_keyboard_capturer_ = false;
|
||||||
#else
|
// #else
|
||||||
render->start_mouse_controller_ = true;
|
render->start_mouse_controller_ = true;
|
||||||
#endif
|
// #endif
|
||||||
if (std::all_of(render->connection_status_.begin(),
|
if (std::all_of(render->connection_status_.begin(),
|
||||||
render->connection_status_.end(), [](const auto& kv) {
|
render->connection_status_.end(), [](const auto& kv) {
|
||||||
return kv.first.find("web") != std::string::npos;
|
return kv.first.find("web") != std::string::npos;
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
|||||||
remote_action.d = i;
|
remote_action.d = i;
|
||||||
if (props->connection_status_ == ConnectionStatus::Connected) {
|
if (props->connection_status_ == ConnectionStatus::Connected) {
|
||||||
std::string msg = remote_action.to_json();
|
std::string msg = remote_action.to_json();
|
||||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||||
props->data_label_.c_str(), false);
|
props->data_label_.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
props->display_selectable_hovered_ = ImGui::IsWindowHovered();
|
props->display_selectable_hovered_ = ImGui::IsWindowHovered();
|
||||||
@@ -173,8 +173,8 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
|||||||
remote_action.type = ControlType::audio_capture;
|
remote_action.type = ControlType::audio_capture;
|
||||||
remote_action.a = props->audio_capture_button_pressed_;
|
remote_action.a = props->audio_capture_button_pressed_;
|
||||||
std::string msg = remote_action.to_json();
|
std::string msg = remote_action.to_json();
|
||||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||||
props->data_label_.c_str(), false);
|
props->data_label_.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
|||||||
int ret = sender.SendFile(
|
int ret = sender.SendFile(
|
||||||
file_path, file_path.filename().string(),
|
file_path, file_path.filename().string(),
|
||||||
[peer, file_label](const char* buf, size_t sz) -> int {
|
[peer, file_label](const char* buf, size_t sz) -> int {
|
||||||
return SendDataFrame(peer, buf, sz, file_label.c_str(), true);
|
return SendReliableDataFrame(peer, buf, sz, file_label.c_str());
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
|||||||
Submodule submodules/minirtc updated: 6db742ffa3...c5622d7104
Reference in New Issue
Block a user