[Fix] More stable Connection
This commit is contained in:
parent
f24b116753
commit
7f7b8a5cdd
6 changed files with 271 additions and 244 deletions
|
|
@ -13,7 +13,7 @@ use uuid::Uuid;
|
|||
use crate::anonymous_clients::anonymous_manager::{self, generate_username};
|
||||
use crate::calls::call_manager;
|
||||
use crate::data::communication::{CommunicationType, CommunicationValue, DataTypes};
|
||||
use crate::omega::omega_connection::{WAITING_TASKS, get_omega_connection};
|
||||
use crate::omega::omega_connection::get_omega_connection;
|
||||
use crate::rho::rho_manager;
|
||||
use crate::util::logger::PrintType;
|
||||
use crate::{log_in, log_out};
|
||||
|
|
@ -328,19 +328,17 @@ impl AnonymousClientConnection {
|
|||
}
|
||||
async fn handle_omega_forward(self: Arc<Self>, cv: CommunicationValue) {
|
||||
let client_for_closure = self.clone();
|
||||
WAITING_TASKS.insert(
|
||||
cv.get_id(),
|
||||
Box::new(move |_, response_cv| {
|
||||
let client = client_for_closure.clone();
|
||||
tokio::spawn(async move {
|
||||
client.send_message(&response_cv).await;
|
||||
});
|
||||
true
|
||||
}),
|
||||
);
|
||||
get_omega_connection()
|
||||
.send_message(&cv.with_sender(*self.user_id.read().await))
|
||||
.await;
|
||||
tokio::spawn(async move {
|
||||
let response_cv = get_omega_connection()
|
||||
.await_response(
|
||||
&cv.with_sender(*self.user_id.read().await),
|
||||
Some(Duration::from_secs(20)),
|
||||
)
|
||||
.await;
|
||||
if let Ok(response_cv) = response_cv {
|
||||
client_for_closure.send_message(&response_cv).await;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Handle ping message
|
||||
|
|
|
|||
Loading…
Reference in a new issue