initial commit
This commit is contained in:
commit
3d9c98eeca
22 changed files with 1075 additions and 0 deletions
19
src/commands/fail.rs
Normal file
19
src/commands/fail.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use std::io::Write;
|
||||
use std::net::TcpStream;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::bank::Bank;
|
||||
use crate::commands::Command;
|
||||
use crate::protocol;
|
||||
|
||||
pub struct Fail;
|
||||
|
||||
impl Command for Fail {
|
||||
fn execute(&self, _: Arc<RwLock<Bank>>, error_code: &[u8], mut stream: &TcpStream) -> Result<usize> {
|
||||
error!("sending error code {}", error_code[0]);
|
||||
let written = stream.write(&protocol::error(error_code[0]))?;
|
||||
Ok(written)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue