Going back to blocking, need a new thread here

This commit is contained in:
Dave Hrycyszyn
2024-06-10 14:26:00 +01:00
parent 4717ffa7e8
commit 91fbe7f9bd

View File

@@ -1,8 +1,7 @@
use async_trait::async_trait; use async_trait::async_trait;
use bft_json_crdt::json_crdt::SignedOp; use bft_json_crdt::json_crdt::SignedOp;
use ezsockets::ClientConfig; use ezsockets::ClientConfig;
use tokio::fs::File; use std::io::BufRead;
use tokio::io;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use crate::{node::SideNode, utils}; use crate::{node::SideNode, utils};
@@ -25,11 +24,10 @@ impl WebSocketClient {
tokio::spawn(async move { tokio::spawn(async move {
future.await.unwrap(); future.await.unwrap();
}); });
let stdin = tokio::io::stdin(); let stdin = std::io::stdin();
// let lines = stdin.lock().lines(); let lines = stdin.lock().lines();
// for line in lines {
let mut reader = FramedRead::new(stdin, LinesCodec::new()); let line = line.unwrap();
let line = reader.next().await.transpose()?.unwrap();
let signed_op = if let "exit" = line.as_str() { let signed_op = if let "exit" = line.as_str() {
break; break;
} else if let "trace" = line.as_str() { } else if let "trace" = line.as_str() {
@@ -44,6 +42,7 @@ impl WebSocketClient {
handle.text(json).unwrap(); handle.text(json).unwrap();
} }
} }
}
#[async_trait] #[async_trait]
impl ezsockets::ClientExt for WebSocketClient { impl ezsockets::ClientExt for WebSocketClient {