[Fix] Add chats, propper rho selection
This commit is contained in:
parent
60c980ba9a
commit
05006980f7
5 changed files with 36 additions and 16 deletions
|
|
@ -270,6 +270,9 @@ impl GeneralConnection {
|
|||
|
||||
let user_id = id as i64;
|
||||
|
||||
let client = ClientConnection::from_general(self.clone(), id).await;
|
||||
client.clone().start();
|
||||
|
||||
let mut rho = rho_manager::get_rho_con_for_user(user_id).await;
|
||||
|
||||
if rho.is_none() {
|
||||
|
|
@ -295,12 +298,10 @@ impl GeneralConnection {
|
|||
|
||||
*self.rho_connection.write().await = rho.clone();
|
||||
|
||||
let client = ClientConnection::from_general(self.clone(), id).await;
|
||||
|
||||
if let Some(rho_conn) = rho {
|
||||
// Make sure user is bound before the client starts forwarding
|
||||
rho_conn.bind_user_id(user_id).await;
|
||||
rho_conn.add_client_connection(client.clone()).await;
|
||||
rho_conn.add_client_connection(client).await;
|
||||
} else {
|
||||
log_err!(
|
||||
user_id,
|
||||
|
|
@ -309,8 +310,6 @@ impl GeneralConnection {
|
|||
id
|
||||
);
|
||||
}
|
||||
|
||||
client.start();
|
||||
}
|
||||
ConnectionKind::Iota => {
|
||||
let notify = CommunicationValue::new(CommunicationType::iota_connected)
|
||||
|
|
@ -323,6 +322,10 @@ impl GeneralConnection {
|
|||
|
||||
iota.set_rho_connection(rho.clone()).await;
|
||||
|
||||
rho_manager::add_rho(rho).await;
|
||||
|
||||
iota.clone().start();
|
||||
|
||||
let get_iota_msg = CommunicationValue::new(CommunicationType::get_iota_data)
|
||||
.add_data(DataTypes::iota_id, DataValue::Number(id as i64));
|
||||
|
||||
|
|
@ -340,10 +343,6 @@ impl GeneralConnection {
|
|||
iota.set_user_ids(user_ids).await;
|
||||
}
|
||||
}
|
||||
|
||||
rho_manager::add_rho(rho).await;
|
||||
|
||||
iota.start();
|
||||
}
|
||||
ConnectionKind::AnonymousClient => {
|
||||
let client = AnonymousClientConnection::from_general(self.clone(), id).await;
|
||||
|
|
|
|||
Loading…
Reference in a new issue