[Fix] reverted some iota_id
This commit is contained in:
parent
c41860509a
commit
cc8c14ca93
1 changed files with 16 additions and 11 deletions
|
|
@ -433,8 +433,10 @@ impl OmikronConnection {
|
||||||
|
|
||||||
async fn handle_iota_connected(self: Arc<Self>, cv: CommunicationValue, omikron_id: i64) {
|
async fn handle_iota_connected(self: Arc<Self>, cv: CommunicationValue, omikron_id: i64) {
|
||||||
log_in!(PrintType::Omega, "IOTA connected");
|
log_in!(PrintType::Omega, "IOTA connected");
|
||||||
let iota_id = cv.get_sender();
|
let iota_id = match cv.get_data(DataTypes::iota_id).as_number() {
|
||||||
let iota_id = iota_id as i64;
|
Some(id) => id as i64,
|
||||||
|
None => return,
|
||||||
|
};
|
||||||
user_online_tracker::track_iota_connection(iota_id, omikron_id, true);
|
user_online_tracker::track_iota_connection(iota_id, omikron_id, true);
|
||||||
|
|
||||||
let mut user_ids = Vec::new();
|
let mut user_ids = Vec::new();
|
||||||
|
|
@ -460,8 +462,10 @@ impl OmikronConnection {
|
||||||
|
|
||||||
async fn handle_iota_disconnected(self: Arc<Self>, cv: CommunicationValue, omikron_id: i64) {
|
async fn handle_iota_disconnected(self: Arc<Self>, cv: CommunicationValue, omikron_id: i64) {
|
||||||
log_in!(PrintType::Omega, "IOTA disconnected");
|
log_in!(PrintType::Omega, "IOTA disconnected");
|
||||||
let iota_id = cv.get_sender();
|
let iota_id = match cv.get_data(DataTypes::iota_id).as_number() {
|
||||||
let iota_id = iota_id as i64;
|
Some(id) => id as i64,
|
||||||
|
None => return,
|
||||||
|
};
|
||||||
let iota_offline = user_online_tracker::untrack_iota_connection(iota_id, omikron_id);
|
let iota_offline = user_online_tracker::untrack_iota_connection(iota_id, omikron_id);
|
||||||
if iota_offline {
|
if iota_offline {
|
||||||
if let Ok(users) = sql::get_users_by_iota_id(iota_id).await {
|
if let Ok(users) = sql::get_users_by_iota_id(iota_id).await {
|
||||||
|
|
@ -612,13 +616,14 @@ impl OmikronConnection {
|
||||||
|
|
||||||
async fn handle_get_iota_data(self: Arc<Self>, cv: CommunicationValue) -> OmikronResult<()> {
|
async fn handle_get_iota_data(self: Arc<Self>, cv: CommunicationValue) -> OmikronResult<()> {
|
||||||
// Try by iota_id
|
// Try by iota_id
|
||||||
let iota_id = cv.get_sender();
|
if let Some(iota_id) = cv.get_data(DataTypes::iota_id).as_number() {
|
||||||
if let Ok((iota_id, public_key)) = get_iota_by_id(iota_id as i64).await {
|
if let Ok((iota_id, public_key)) = get_iota_by_id(iota_id as i64).await {
|
||||||
let response = self
|
let response = self
|
||||||
.clone()
|
.clone()
|
||||||
.build_iota_data_response(cv.get_id(), iota_id, public_key, None, None)
|
.build_iota_data_response(cv.get_id(), iota_id, public_key, None, None)
|
||||||
.await;
|
.await;
|
||||||
return self.send(&response).await;
|
return self.send(&response).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try by user_id
|
// Try by user_id
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue