Going back to blocking, need a new thread here
This commit is contained in:
@@ -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() {
|
||||||
@@ -43,6 +41,7 @@ impl WebSocketClient {
|
|||||||
let json = serde_json::to_string(&signed_op).unwrap();
|
let json = serde_json::to_string(&signed_op).unwrap();
|
||||||
handle.text(json).unwrap();
|
handle.text(json).unwrap();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
|
|||||||
Reference in New Issue
Block a user