1
This commit is contained in:
parent
73618b38d8
commit
e8f05c5424
@ -3,9 +3,11 @@ use std::sync::Mutex;
|
||||
use crate::listener::WsListener;
|
||||
use crate::upstream::UpStreamMgr;
|
||||
use crate::common::types::DownStreamPack;
|
||||
use crate::master::MasterMgr;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
pub struct UserApp {
|
||||
pub _masterMgr: MasterMgr,
|
||||
down_stream_msg_queue: Arc::<std::sync::Mutex::<r9::QueueLock<DownStreamPack>>>,
|
||||
}
|
||||
|
||||
@ -16,6 +18,7 @@ impl f9::app::UserApp for UserApp {
|
||||
}
|
||||
|
||||
fn init(&self) {
|
||||
MasterMgr::instance().init();
|
||||
WsListener::instance().init();
|
||||
UpStreamMgr::instance().borrow_mut().init();
|
||||
}
|
||||
@ -49,6 +52,7 @@ impl f9::app::UserApp for UserApp {
|
||||
|
||||
fn uninit(&self) {
|
||||
WsListener::instance().uninit();
|
||||
MasterMgr::instance().uninit();
|
||||
}
|
||||
|
||||
fn get_http_listen_port(&self) -> i32 {
|
||||
@ -66,6 +70,7 @@ impl UserApp {
|
||||
}
|
||||
pub fn new() -> Self {
|
||||
let p = UserApp{
|
||||
_masterMgr: MasterMgr::new(),
|
||||
down_stream_msg_queue: r9::QueueLock::<DownStreamPack>::new(),
|
||||
};
|
||||
return p;
|
||||
|
@ -7,6 +7,7 @@ mod downstream;
|
||||
mod ss;
|
||||
mod constant;
|
||||
mod common;
|
||||
mod master;
|
||||
|
||||
use crate::app::UserApp;
|
||||
|
||||
|
4
server/stat/src/master.rs
Normal file
4
server/stat/src/master.rs
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
pub mod mastermgr;
|
||||
|
||||
pub use mastermgr::*;
|
0
server/stat/src/master/master.rs
Normal file
0
server/stat/src/master/master.rs
Normal file
33
server/stat/src/master/mastermgr.rs
Normal file
33
server/stat/src/master/mastermgr.rs
Normal file
@ -0,0 +1,33 @@
|
||||
use std::collections::HashMap;
|
||||
use crate::app::UserApp;
|
||||
|
||||
pub struct MasterMgr {
|
||||
curr_context_id: i64,
|
||||
mastersvr_hash: HashMap<i32, i32>,
|
||||
}
|
||||
|
||||
|
||||
impl MasterMgr {
|
||||
|
||||
|
||||
pub fn instance() -> &'static Self {
|
||||
return &UserApp::instance()._masterMgr;
|
||||
}
|
||||
|
||||
pub fn new() -> Self {
|
||||
let p = Self{
|
||||
curr_context_id: 0,
|
||||
mastersvr_hash: Default::default(),
|
||||
};
|
||||
return p;
|
||||
}
|
||||
|
||||
pub fn init(&self) {
|
||||
|
||||
}
|
||||
|
||||
pub fn uninit(&self) {
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user