clean use and paralelice config server
This commit is contained in:
		
							parent
							
								
									8991a7fbf0
								
							
						
					
					
						commit
						6530d7b64a
					
				| @ -1,10 +1,8 @@ | |||||||
| use std::net::{TcpListener, TcpStream}; | use std::net::{TcpListener, TcpStream}; | ||||||
| use std::os::unix::net::{UnixListener, UnixStream}; | use std::os::unix::net::{UnixStream}; | ||||||
| use std::io::prelude::*; | use std::io::prelude::*; | ||||||
| use std::result; |  | ||||||
| use crate::conf; | use crate::conf; | ||||||
| use std::sync::{Arc, RwLock}; | use std::sync::{Arc, RwLock}; | ||||||
| use std::path::{Path, PathBuf}; |  | ||||||
| 
 | 
 | ||||||
| const OP_ADD: u8 = 0; | const OP_ADD: u8 = 0; | ||||||
| const OP_DEL: u8 = 1; | const OP_DEL: u8 = 1; | ||||||
|  | |||||||
| @ -1,9 +1,8 @@ | |||||||
| use std::net::{TcpListener, TcpStream}; | use std::net::{TcpListener, TcpStream}; | ||||||
| use std::os::unix::net::{UnixListener, UnixStream}; | use std::os::unix::net::{UnixListener}; | ||||||
| use std::io::prelude::*; |  | ||||||
| use std::result; |  | ||||||
| use crate::conf; | use crate::conf; | ||||||
| use crate::server_conf::conexion::Conexion; | use crate::server_conf::conexion::Conexion; | ||||||
|  | use std::thread; | ||||||
| use std::sync::{Arc, RwLock}; | use std::sync::{Arc, RwLock}; | ||||||
| use std::path::{Path, PathBuf}; | use std::path::{Path, PathBuf}; | ||||||
| 
 | 
 | ||||||
| @ -35,7 +34,8 @@ pub fn start(conf: Arc<RwLock<conf::Config>>){ | |||||||
|     for stream in ser.listener.incoming() { |     for stream in ser.listener.incoming() { | ||||||
|         match stream{ |         match stream{ | ||||||
|         Ok(s) => { |         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), |         Err(_e) => println!("{}",_e), | ||||||
|         } |         } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user