Server

Struct Server 

Source
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

Source

pub fn new() -> Self

Source

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

Source

fn close_duplicated_handle_from_map(&mut self)

Source

fn handle_get_handle_request( &mut self, file_path: &str, stream: Arc<RwLock<TcpStream>>, ) -> PisPasResult<()>

Source

fn verify_and_restore_from_backup(&self, file_path: &str) -> PisPasResult<()>

Verifica si existe backup y restaura si es necesario

Source

pub fn cleanup_file_handles(&mut self)

Cierra todos los handles de archivos mapeados al finalizar el servicio

Source

pub fn _list_mapped_files(&self) -> Vec<String>

Lista todos los archivos actualmente mapeados (para debugging)

Source

pub fn _remove_file_mapping(&mut self, file_path: &str) -> PisPasResult<()>

Remueve un archivo específico del mapa y cierra su handle

Source

fn write_stream( stream: Arc<RwLock<TcpStream>>, message: &str, ) -> PisPasResult<()>

Source

pub fn change_status(&mut self, status: DriverStatus)

Source

fn launch_process(&mut self, launch_first: bool) -> PisPasResult<DriverStatus>

Source

pub fn stop_process(&mut self) -> PisPasResult<DriverStatus>

Source

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

Source

fn process_message( pispas_service: Arc<RwLock<Server>>, message: &str, stream: Arc<RwLock<TcpStream>>, needs_close: Arc<AtomicBool>, ) -> PisPasResult<()>

Source

pub fn notify_subscriber(&mut self, message: &str)

Source

pub fn handle_message( pispas_service: Arc<RwLock<Server>>, stream: Arc<RwLock<TcpStream>>, stop: Arc<AtomicBool>, )

Source

fn watchdog(thread_service: Arc<RwLock<Server>>, thread_cancel: Arc<AtomicBool>)

Source

fn still_active_process(thread_clone: Arc<RwLock<Server>>)

Source

pub fn on_service_stop(&mut self) -> PisPasResult<()>

Método interno del server para manejar el evento de stop

Source

fn files_are_different(&self, file1: &str, file2: &Path) -> PisPasResult<bool>

Compara si dos archivos son diferentes

Source

fn start_server( listener: Arc<RwLock<TcpListener>>, stop_arc: Arc<AtomicBool>, pispas_service: Arc<RwLock<Server>>, )

Source

pub fn run_server( pispas_service: Arc<RwLock<Server>>, stop_arc: Arc<AtomicBool>, )

Source

pub fn check(&mut self) -> PisPasResult<()>

Trait Implementations§

Source§

impl Debug for Server

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more