aboutsummaryrefslogtreecommitdiff
path: root/karld/src/interface/stdio.rs
diff options
context:
space:
mode:
authormetamuffin <yvchraiqi@protonmail.com>2022-08-17 22:04:32 +0200
committermetamuffin <yvchraiqi@protonmail.com>2022-08-17 22:04:32 +0200
commit4cad1fc66422f84ade7ee29f86f5a43738c065f4 (patch)
tree815e44d69cc34d42669c866d043f7d09d3172290 /karld/src/interface/stdio.rs
parente87219d47764f82d073f464a23aa18a6f7d0c9d3 (diff)
downloadkarlender-4cad1fc66422f84ade7ee29f86f5a43738c065f4.tar
karlender-4cad1fc66422f84ade7ee29f86f5a43738c065f4.tar.bz2
karlender-4cad1fc66422f84ade7ee29f86f5a43738c065f4.tar.zst
add more interfaces
Diffstat (limited to 'karld/src/interface/stdio.rs')
-rw-r--r--karld/src/interface/stdio.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/karld/src/interface/stdio.rs b/karld/src/interface/stdio.rs
new file mode 100644
index 0000000..b10dfc0
--- /dev/null
+++ b/karld/src/interface/stdio.rs
@@ -0,0 +1,13 @@
+use log::{error, info};
+
+use crate::CLIENT_ID_COUNTER;
+
+use super::generic::generic_handle_connection;
+
+pub fn run() {
+ let id = CLIENT_ID_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
+ info!("reading packets from stdin");
+ if let Err(e) = generic_handle_connection(id, std::io::stdin(), std::io::stdout()) {
+ error!("{e}");
+ }
+}