performed cleanup of server

This commit is contained in:
michael-bailey 2022-09-14 08:27:29 +01:00
parent a31aa95d2b
commit ccbc680c0e
3 changed files with 7 additions and 14 deletions

View File

@ -14,12 +14,10 @@ use server::Server;
use tokio::time::{sleep, Duration};
use crate::config_manager::ConfigManager;
/// The main function
#[actix::main()]
async fn main() {
let init = Server::create(ConfigManager::shared()).build();
let _init = Server::create().build();
loop {
sleep(Duration::from_millis(1000)).await;
}

View File

@ -1,18 +1,15 @@
use actix::{Actor, Addr};
use crate::config_manager::ConfigManager;
use super::*;
use actix::{Actor, Addr};
pub struct ServerBuilder {
pub(super) config: Addr<ConfigManager>,
pub(super) name: Option<String>,
pub(super) port: Option<u16>,
pub(super) owner: Option<String>,
}
impl<'rhai> ServerBuilder {
pub(super) fn new(config_manager: Addr<ConfigManager>) -> Self {
pub(super) fn new() -> Self {
Self {
config: config_manager,
name: None,
port: None,
owner: None,
@ -37,4 +34,4 @@ impl<'rhai> ServerBuilder {
pub fn build(self) -> Addr<Server> {
Server::from(self).start()
}
}
}

View File

@ -36,10 +36,8 @@ pub struct Server {
}
impl Server {
pub(crate) fn create(
config_manager: Addr<ConfigManager>,
) -> builder::ServerBuilder {
ServerBuilder::new(config_manager)
pub(crate) fn create() -> builder::ServerBuilder {
ServerBuilder::new()
}
pub(crate) fn client_request(
@ -189,7 +187,7 @@ impl Handler<ClientManagerOutput> for Server {
}
impl From<ServerBuilder> for Server {
fn from(builder: ServerBuilder) -> Self {
fn from(_builder: ServerBuilder) -> Self {
Server {
name: None,
owner: None,