node: Test control socket

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-09-13 10:16:05 +02:00
parent 12dd6d4a5d
commit 400ba8d935
4 changed files with 90 additions and 10 deletions
+26
View File
@@ -0,0 +1,26 @@
use std::sync::{Arc, Mutex};
use crate::client::handle;
use crate::client::handle::traits;
use crate::{client, identity, protocol};
#[derive(Default, Clone)]
pub struct Handle {
pub updates: Arc<Mutex<Vec<identity::ProjId>>>,
}
impl traits::Handle for Handle {
fn updated(&self, id: identity::ProjId) -> Result<(), handle::Error> {
self.updates.lock().unwrap().push(id);
Ok(())
}
fn command(&self, _cmd: protocol::Command) -> Result<(), handle::Error> {
Ok(())
}
fn shutdown(self) -> Result<(), client::handle::Error> {
Ok(())
}
}