Fix unix config and refactor configs
This commit is contained in:
@@ -3,7 +3,7 @@ use crate::server_conf::conexion::Conexion;
|
||||
use crate::server_conf::listener::GenericListener;
|
||||
use std::thread;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use log::{error,info};
|
||||
use log::{error,warn,info};
|
||||
|
||||
pub struct ConfSer{
|
||||
path: String,
|
||||
@@ -11,11 +11,17 @@ pub struct ConfSer{
|
||||
}
|
||||
|
||||
impl ConfSer {
|
||||
fn new(path: &String, conf_type: &String) -> ConfSer{
|
||||
fn new(path: String, conf_type: &String) -> ConfSer{
|
||||
ConfSer{
|
||||
path: path.clone(),
|
||||
listener: GenericListener::bind(path,
|
||||
GenericListener::string_top_type(conf_type)).unwrap(),
|
||||
listener: match GenericListener::bind(path,
|
||||
GenericListener::string_top_type(conf_type)){
|
||||
Ok(l) => l,
|
||||
Err(e) => {
|
||||
warn!("Error al levantar el servidor de configuraciones:{}",e);
|
||||
panic!("Error al levantar el servidor de configuraciones:{}",e)
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,8 +35,10 @@ impl Drop for ConfSer {
|
||||
}
|
||||
|
||||
pub fn start(conf: Arc<RwLock<conf::Config>>){
|
||||
let ser = ConfSer::new(conf.read().unwrap().get_port_conf()
|
||||
,conf.read().unwrap().get_conf_type());
|
||||
let ser = ConfSer::new(
|
||||
conf.read().unwrap().get_bindeable_conf(),
|
||||
conf.read().unwrap().get_conf_type(),
|
||||
);
|
||||
|
||||
loop{
|
||||
match ser.listener.accept() {
|
||||
|
||||
Reference in New Issue
Block a user