21 lines
428 B
Rust
21 lines
428 B
Rust
use std::io::Write;
|
|
use std::net::TcpStream;
|
|
use std::sync::{Arc, RwLock};
|
|
|
|
use anyhow::Result;
|
|
|
|
use bank::bank::Bank;
|
|
|
|
use crate::commands::Command;
|
|
use crate::protocol;
|
|
|
|
pub struct Pong;
|
|
|
|
impl Command for Pong {
|
|
fn execute(&self, _: Arc<RwLock<Bank>>, _: &[u8], mut stream: &TcpStream) -> Result<usize> {
|
|
info!("sending 'pong'");
|
|
let written = stream.write(&[protocol::PONG])?;
|
|
Ok(written)
|
|
}
|
|
}
|