pub struct Server {
process: Option<MyHandler>,
tray_status: Arc<RwLock<DriverStatus>>,
subcribe_vector: Vec<Arc<RwLock<TcpStream>>>,
started: bool,
last_status_send: Arc<RwLock<String>>,
map_files: Arc<RwLock<HashMap<String, Option<HandlePair>>>>,
}Fields§
§process: Option<MyHandler>§tray_status: Arc<RwLock<DriverStatus>>§subcribe_vector: Vec<Arc<RwLock<TcpStream>>>§started: bool§last_status_send: Arc<RwLock<String>>§map_files: Arc<RwLock<HashMap<String, Option<HandlePair>>>>Implementations§
Source§impl Server
impl Server
pub fn new() -> Self
Sourcefn create_or_open_protected_file(
&mut self,
file_path: &str,
target_process: HANDLE,
) -> PisPasResult<(HANDLE, HANDLE)>
fn create_or_open_protected_file( &mut self, file_path: &str, target_process: HANDLE, ) -> PisPasResult<(HANDLE, HANDLE)>
Creates or opens the specified file and returns a duplicated handle El service.exe mantiene el handle principal para protección contra borrados Returns both original and duplicated handles
fn close_duplicated_handle_from_map(&mut self)
fn handle_get_handle_request( &mut self, file_path: &str, stream: Arc<RwLock<TcpStream>>, ) -> PisPasResult<()>
Sourcefn verify_and_restore_from_backup(&self, file_path: &str) -> PisPasResult<()>
fn verify_and_restore_from_backup(&self, file_path: &str) -> PisPasResult<()>
Verifica si existe backup y restaura si es necesario
Sourcepub fn cleanup_file_handles(&mut self)
pub fn cleanup_file_handles(&mut self)
Cierra todos los handles de archivos mapeados al finalizar el servicio
Sourcepub fn _list_mapped_files(&self) -> Vec<String>
pub fn _list_mapped_files(&self) -> Vec<String>
Lista todos los archivos actualmente mapeados (para debugging)
Sourcepub fn _remove_file_mapping(&mut self, file_path: &str) -> PisPasResult<()>
pub fn _remove_file_mapping(&mut self, file_path: &str) -> PisPasResult<()>
Remueve un archivo específico del mapa y cierra su handle
fn write_stream( stream: Arc<RwLock<TcpStream>>, message: &str, ) -> PisPasResult<()>
pub fn change_status(&mut self, status: DriverStatus)
fn launch_process(&mut self, launch_first: bool) -> PisPasResult<DriverStatus>
pub fn stop_process(&mut self) -> PisPasResult<DriverStatus>
Sourcefn handle_close_handle_request(
&mut self,
file_path: &str,
stream: Arc<RwLock<TcpStream>>,
) -> PisPasResult<()>
fn handle_close_handle_request( &mut self, file_path: &str, stream: Arc<RwLock<TcpStream>>, ) -> PisPasResult<()>
Handles the CLOSE_HANDLE request for a specific file path
fn process_message( pispas_service: Arc<RwLock<Server>>, message: &str, stream: Arc<RwLock<TcpStream>>, needs_close: Arc<AtomicBool>, ) -> PisPasResult<()>
pub fn notify_subscriber(&mut self, message: &str)
pub fn handle_message( pispas_service: Arc<RwLock<Server>>, stream: Arc<RwLock<TcpStream>>, stop: Arc<AtomicBool>, )
fn watchdog(thread_service: Arc<RwLock<Server>>, thread_cancel: Arc<AtomicBool>)
fn still_active_process(thread_clone: Arc<RwLock<Server>>)
Sourcepub fn on_service_stop(&mut self) -> PisPasResult<()>
pub fn on_service_stop(&mut self) -> PisPasResult<()>
Método interno del server para manejar el evento de stop
Sourcefn files_are_different(&self, file1: &str, file2: &Path) -> PisPasResult<bool>
fn files_are_different(&self, file1: &str, file2: &Path) -> PisPasResult<bool>
Compara si dos archivos son diferentes
fn start_server( listener: Arc<RwLock<TcpListener>>, stop_arc: Arc<AtomicBool>, pispas_service: Arc<RwLock<Server>>, )
pub fn run_server( pispas_service: Arc<RwLock<Server>>, stop_arc: Arc<AtomicBool>, )
pub fn check(&mut self) -> PisPasResult<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more