Reorganize and refactor, adding integration test for common library stuff
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
use crate::repository::PasswordDirectory;
|
||||
use common::{Request, RESPONSE_NO, RESPONSE_OK};
|
||||
use common::request::Request;
|
||||
use std::io::{Error, Write};
|
||||
use std::os::unix::net::UnixStream;
|
||||
|
||||
pub const RESPONSE_NO: [u8; 4] = [0x0, 0x2, b'N', b'O'];
|
||||
pub const RESPONSE_OK: [u8; 4] = [0x0, 0x2, b'O', b'K'];
|
||||
|
||||
pub struct Handler {
|
||||
stream: UnixStream,
|
||||
handler: PasswordDirectory,
|
||||
}
|
||||
|
||||
impl Handler {
|
||||
pub fn new(stream: UnixStream, handler: PasswordDirectory) -> Result<Handler, Error> {
|
||||
Ok(Handler { stream, handler })
|
||||
pub fn new(stream: UnixStream, handler: PasswordDirectory) -> Handler {
|
||||
Handler { stream, handler }
|
||||
}
|
||||
|
||||
fn communicate(&mut self) -> Result<(), Error> {
|
||||
|
||||
Reference in New Issue
Block a user