clean use and paralelice config server

This commit is contained in:
Guillermo Roche 2022-12-13 22:47:22 +01:00
parent 8991a7fbf0
commit 6530d7b64a
2 changed files with 5 additions and 7 deletions

View File

@ -1,10 +1,8 @@
use std::net::{TcpListener, TcpStream};
use std::os::unix::net::{UnixListener, UnixStream};
use std::os::unix::net::{UnixStream};
use std::io::prelude::*;
use std::result;
use crate::conf;
use std::sync::{Arc, RwLock};
use std::path::{Path, PathBuf};
const OP_ADD: u8 = 0;
const OP_DEL: u8 = 1;

View File

@ -1,9 +1,8 @@
use std::net::{TcpListener, TcpStream};
use std::os::unix::net::{UnixListener, UnixStream};
use std::io::prelude::*;
use std::result;
use std::os::unix::net::{UnixListener};
use crate::conf;
use crate::server_conf::conexion::Conexion;
use std::thread;
use std::sync::{Arc, RwLock};
use std::path::{Path, PathBuf};
@ -35,7 +34,8 @@ pub fn start(conf: Arc<RwLock<conf::Config>>){
for stream in ser.listener.incoming() {
match stream{
Ok(s) => {
Conexion::new(conf.clone(), s).process_reques();
let c = conf.clone();
thread::spawn(|| Conexion::new(c, s).process_reques());
},
Err(_e) => println!("{}",_e),
}