submodules adj

pull/14/head
prplV 2024-12-12 17:04:20 +03:00
parent a75160c3e2
commit b51a3fb0f0
4 changed files with 10 additions and 8 deletions

View File

@ -1,11 +1,16 @@
mod cli; mod cli;
mod net;
use clap::Parser; use clap::Parser;
use cli::Cli; use cli::Cli;
use net::{create_tcp_stream, try_send};
use anyhow::Result;
fn main() -> Result<(), std::io::Error>{ #[tokio::main]
async fn main() -> Result<()>{
let cli = Cli::parse(); let cli = Cli::parse();
dbg!(&cli); dbg!(&cli);
println!("{:?}", cli); // println!("{:?}", cli);
try_send(create_tcp_stream().await, cli).await?;
Ok(()) Ok(())
} }

View File

@ -13,8 +13,6 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use utils::*; use utils::*;
#[allow(unused_imports)]
use options::preboot::PrebootParams; use options::preboot::PrebootParams;
#[tokio::main(flavor = "multi_thread")] #[tokio::main(flavor = "multi_thread")]

View File

@ -47,15 +47,14 @@ async fn process_connection(mut stream: TcpStream) {
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();
while let Ok(Some(line)) = rqst.next_line().await { while let Ok(Some(line)) = rqst.next_line().await {
if line.is_empty() { if line.is_empty() {
break; break;
} }
println!("{}", line); println!("{}", line);
} }
// .map(|result| result.unwrap())
// .take_while(|line| !line.is_empty())
// .collect();
let response = "HTTP/1.1 200 OK\r\nContent-Length: 13\r\nContent-Type: text/plain\r\n\r\nHello, World!"; let response = "HTTP/1.1 200 OK\r\nContent-Length: 13\r\nContent-Type: text/plain\r\n\r\nHello, World!";
stream.write_all(response.as_bytes()).await.unwrap(); stream.write_all(response.as_bytes()).await.unwrap();
} }

View File

@ -322,7 +322,7 @@ pub async fn subscribe_config_stream(actual_prcs: Arc<Processes>, params: Arc<Pr
if params.no_sub || params.no_remote_config { if params.no_sub || params.no_remote_config {
return Err(CustomError::Fatal); return Err(CustomError::Fatal);
} }
if let Ok(client) = Client::open(format!("redis://{}/", &actual_prcs.config_server)) { if let Ok(client) = Client::open(format!("redis://{}/", &params.remote_server_url)) {
if let Ok(mut conn) = client.get_connection() { if let Ok(mut conn) = client.get_connection() {
match crate::utils::get_container_id() { match crate::utils::get_container_id() {
Some(channel_name) => { Some(channel_name) => {