[Fix] Omikron & Omega Connection
This commit is contained in:
parent
7532235ab0
commit
41d4014ca5
8 changed files with 30 additions and 47 deletions
|
|
@ -42,9 +42,9 @@ impl ClientConnection {
|
|||
pub fn start(self: Arc<Self>) {
|
||||
let self_clone = self.clone();
|
||||
tokio::spawn(async move {
|
||||
while let Ok(cv) = self_clone.receiver.receive().await {
|
||||
/*while let Ok(cv) = self_clone.receiver.receive().await {
|
||||
self_clone.clone().handle_message(cv).await;
|
||||
}
|
||||
}*/
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ impl GeneralConnection {
|
|||
impl GeneralConnection {
|
||||
pub async fn handle(self: Arc<Self>) {
|
||||
loop {
|
||||
let cv = match self.receiver.receive().await {
|
||||
/*let cv = match self.receiver.receive().await {
|
||||
Ok(v) => v,
|
||||
Err(_) => break,
|
||||
};
|
||||
|
|
@ -70,7 +70,7 @@ impl GeneralConnection {
|
|||
|
||||
if self.migrate().await {
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
async fn handle_identification(self: &Arc<Self>, cv: CommunicationValue) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use epsilon_core::DataTypes;
|
|||
use epsilon_core::DataValue;
|
||||
use epsilon_native::Receiver;
|
||||
use epsilon_native::Sender;
|
||||
use std::collections::BTreeMap;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{Arc, Weak},
|
||||
|
|
@ -53,9 +54,9 @@ impl IotaConnection {
|
|||
pub fn start(self: Arc<Self>) {
|
||||
let self_clone = self.clone();
|
||||
tokio::spawn(async move {
|
||||
while let Ok(cv) = self_clone.receiver.receive().await {
|
||||
/*while let Ok(cv) = self_clone.receiver.receive().await {
|
||||
self_clone.clone().handle_message(cv).await;
|
||||
}
|
||||
}*/
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +244,7 @@ impl IotaConnection {
|
|||
let admin = call_self.has_admin();
|
||||
|
||||
// Build call container
|
||||
let mut call_map: HashMap<DataTypes, DataValue> = HashMap::new();
|
||||
let mut call_map: BTreeMap<DataTypes, DataValue> = BTreeMap::new();
|
||||
|
||||
call_map.insert(DataTypes::call_id, DataValue::Str(call.call_id.to_string()));
|
||||
|
||||
|
|
@ -278,7 +279,7 @@ impl IotaConnection {
|
|||
if let DataValue::Array(users) = cv.get_data(DataTypes::user_ids) {
|
||||
for user_val in users {
|
||||
if let DataValue::Container(entries) = user_val {
|
||||
let mut user_map: HashMap<DataTypes, DataValue> =
|
||||
let mut user_map: BTreeMap<DataTypes, DataValue> =
|
||||
entries.iter().cloned().collect();
|
||||
|
||||
// extract user_id
|
||||
|
|
|
|||
|
|
@ -1,32 +1,17 @@
|
|||
use crate::{log, rho::connection::GeneralConnection, util::file_util::load_file_vec};
|
||||
use crate::{
|
||||
log,
|
||||
rho::connection::GeneralConnection,
|
||||
util::{file_util::load_file_vec, logger::PrintType},
|
||||
};
|
||||
use epsilon_native::Host;
|
||||
|
||||
pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let cert_pem = load_file_vec("certs", "cert.pem")
|
||||
.map_err(|e| format!("Failed to load certificate: {}", e))?;
|
||||
let key_pem = load_file_vec("certs", "key.pem")
|
||||
.map_err(|e| format!("Failed to load private key: {}", e))?;
|
||||
let cert_pem = load_file_vec("certs", "cert.pem").expect("Error loading Pemfile");
|
||||
|
||||
<<<<<<< HEAD
|
||||
let key_pem = load_file_vec("certs", "key.pem").unwrap();
|
||||
let cert_pem = load_file_vec("certs", "cert.pem").unwrap();
|
||||
let key_pem = load_file_vec("certs", "key.pem").expect("Error loading Keyfile");
|
||||
|
||||
let mut host: Host = epsilon_native::host(port, cert_pem, key_pem).await.unwrap();
|
||||
tokio::spawn(async move {
|
||||
while let Some((sender, receiver)) = host.next().await {
|
||||
tokio::spawn(async move {
|
||||
GeneralConnection::new(sender, receiver).handle().await;
|
||||
});
|
||||
}
|
||||
});
|
||||
=======
|
||||
let mut host: Host = epsilon_native::host(port, cert_pem, key_pem).await?;
|
||||
log!(
|
||||
0,
|
||||
crate::util::logger::PrintType::Omikron,
|
||||
"Webtransport Server listening on port {}",
|
||||
port
|
||||
);
|
||||
log!(0, PrintType::General, "Server listening on port {}", port);
|
||||
|
||||
while let Some((sender, receiver)) = host.next().await {
|
||||
tokio::spawn(async move {
|
||||
|
|
@ -36,5 +21,4 @@ pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
|
||||
Ok(())
|
||||
>>>>>>> b2e6e903f789a81dd3629c21c08f03bbb430280b
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue