Cleanup & More migration To TTP
This commit is contained in:
parent
41d4014ca5
commit
cce13a2b5a
8 changed files with 253 additions and 2226 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) {
|
||||
|
|
|
|||
|
|
@ -54,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;
|
||||
}*/
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +104,14 @@ impl IotaConnection {
|
|||
if !cv.is_type(CommunicationType::pong) {
|
||||
log_cv_out!(PrintType::Iota, cv);
|
||||
}
|
||||
self.sender.send(&cv).await;
|
||||
if let Err(e) = self.sender.send(&cv).await {
|
||||
log_err!(
|
||||
self.iota_id as i64,
|
||||
PrintType::Iota,
|
||||
"Failed to send message: {:?}",
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle incoming message from Iota
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
|||
conn.handle().await;
|
||||
});
|
||||
}
|
||||
log!(0, PrintType::General, "Server stopped");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue