mirror of
https://github.com/MeexReay/bRAC.git
synced 2025-06-24 10:52:58 +03:00
Fix: send message freezes
This commit is contained in:
parent
388bfb7672
commit
a9fb66a8fd
@ -669,27 +669,25 @@ fn build_ui(ctx: Arc<Context>, app: &Application) -> UiModel {
|
|||||||
#[weak]
|
#[weak]
|
||||||
ctx,
|
ctx,
|
||||||
move |_| {
|
move |_| {
|
||||||
if text_entry.text().is_empty() {
|
let text = text_entry.text().clone();
|
||||||
|
|
||||||
|
if text.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
timeout_add_local_once(
|
|
||||||
Duration::ZERO,
|
|
||||||
clone!(
|
|
||||||
#[weak]
|
|
||||||
text_entry,
|
|
||||||
move || {
|
|
||||||
text_entry.set_text("");
|
|
||||||
}
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if let Err(e) = on_send_message(ctx.clone(), &text_entry.text()) {
|
text_entry.set_text("");
|
||||||
|
|
||||||
|
thread::spawn({
|
||||||
|
move || {
|
||||||
|
if let Err(e) = on_send_message(ctx.clone(), &text) {
|
||||||
if ctx.config(|o| o.debug_logs) {
|
if ctx.config(|o| o.debug_logs) {
|
||||||
let msg = format!("Send message error: {}", e.to_string()).to_string();
|
let msg = format!("Send message error: {}", e.to_string()).to_string();
|
||||||
add_chat_messages(ctx.clone(), vec![msg]);
|
add_chat_messages(ctx.clone(), vec![msg]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
text_entry.connect_activate(clone!(
|
text_entry.connect_activate(clone!(
|
||||||
|
@ -182,7 +182,7 @@ pub fn connect(host: &str, proxy: Option<String>) -> Result<RacStream, Box<dyn E
|
|||||||
|
|
||||||
if wrac {
|
if wrac {
|
||||||
let (client, _) = client_with_config(
|
let (client, _) = client_with_config(
|
||||||
&format!("ws{}://{host}", if ssl { "s" } else { "" }),
|
&format!("ws://{host}"),
|
||||||
stream,
|
stream,
|
||||||
Some(WebSocketConfig::default().max_message_size(Some(512 * 1024 * 1024))), // TODO: softcode this
|
Some(WebSocketConfig::default().max_message_size(Some(512 * 1024 * 1024))), // TODO: softcode this
|
||||||
)?;
|
)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user