import refactor

pull/19/head
prplV 2024-12-27 13:47:54 +03:00
parent ce067efffd
commit 8b123cd593
6 changed files with 7 additions and 10 deletions

View File

@ -20,7 +20,7 @@ use tokio::io::{BufReader, AsyncWriteExt, AsyncBufReadExt};
/// *depends on* : - /// *depends on* : -
/// ///
pub async fn init_cli_pipeline() -> DynResult<()> { pub async fn init_cli_pipeline() -> DynResult<()> {
return match init_listener().await { match init_listener().await {
Some(list) => { Some(list) => {
loop { loop {
if let Ok((socket, addr)) = list.accept().await { if let Ok((socket, addr)) = list.accept().await {
@ -53,7 +53,7 @@ pub async fn init_cli_pipeline() -> DynResult<()> {
/// *depends on* : `tokio::net::TcpListener` /// *depends on* : `tokio::net::TcpListener`
/// ///
async fn init_listener() -> Option<TcpListener> { async fn init_listener() -> Option<TcpListener> {
return match TcpListener::bind("127.0.0.1:7753").await { match TcpListener::bind("127.0.0.1:7753").await {
Ok(listener) => { Ok(listener) => {
info!("Runner is listening localhost:7753"); info!("Runner is listening localhost:7753");
Some(listener) Some(listener)
@ -79,9 +79,6 @@ async fn init_listener() -> Option<TcpListener> {
/// *depends on* : `tokio::net::TcpStream` /// *depends on* : `tokio::net::TcpStream`
/// ///
async fn process_connection(mut stream: TcpStream) { async fn process_connection(mut stream: TcpStream) {
// loop{
// stream.
// }
let buf_reader = BufReader::new(stream.borrow_mut()); let buf_reader = BufReader::new(stream.borrow_mut());
let mut rqst = buf_reader.lines(); let mut rqst = buf_reader.lines();

View File

@ -1,4 +1,4 @@
use crate::options::structs::*; use super::structs::*;
use log::{error, info, warn}; use log::{error, info, warn};
use redis::{Client, Connection}; use redis::{Client, Connection};
use std::fs::OpenOptions; use std::fs::OpenOptions;

View File

@ -1,4 +1,4 @@
use crate::options::structs::CustomError; use super::structs::CustomError;
use std::sync::Arc; use std::sync::Arc;
use tokio::io; use tokio::io;
use tokio::sync::mpsc; use tokio::sync::mpsc;

View File

@ -1,5 +1,5 @@
use crate::options::structs::{CustomError, Files}; use crate::options::structs::{CustomError, Files};
use crate::utils::prcs::{is_active, is_frozen}; use super::prcs::{is_active, is_frozen};
use inotify::{EventMask, Inotify, WatchMask}; use inotify::{EventMask, Inotify, WatchMask};
use std::borrow::BorrowMut; use std::borrow::BorrowMut;
use std::path::Path; use std::path::Path;

View File

@ -7,7 +7,7 @@ use crate::options::structs::TrackingProcess;
use sysinfo::{Process, System}; use sysinfo::{Process, System};
use tokio::join; use tokio::join;
use crate::options::structs::{ProcessMetrics, ContainerMetrics}; use crate::options::structs::{ProcessMetrics, ContainerMetrics};
use crate::utils::get_container_id; use super::get_container_id;
// use pcap::{Device, Capture, Active}; // use pcap::{Device, Capture, Active};
// use std::net::Ipv4Addr; // use std::net::Ipv4Addr;
// use anyhow::{Result, Ok}; // use anyhow::{Result, Ok};

View File

@ -1,5 +1,5 @@
use crate::options::structs::{CustomError, Services}; use crate::options::structs::{CustomError, Services};
use crate::utils::prcs::{is_active, is_frozen}; use super::prcs::{is_active, is_frozen};
use log::{error, warn}; use log::{error, warn};
use std::net::{TcpStream, ToSocketAddrs}; use std::net::{TcpStream, ToSocketAddrs};
use std::sync::Arc; use std::sync::Arc;