Skip to content

Commit

Permalink
Bump version to 0.1.7.
Browse files Browse the repository at this point in the history
Update dependencies.
Remove futures-executor.
  • Loading branch information
red-dal committed Jul 20, 2022
1 parent d2644f0 commit 4f037e3
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 59 deletions.
78 changes: 29 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion ladder_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ __codec = []

[dependencies]
ladder_lib_macro = { path = "../ladder_lib_macro" }
futures = "0.3"
futures = { version = "0.3", default-features = false, features = [
"std",
"async-await"
] }
idna = "0.2"
tokio = { version = "1.0", default-features = false, features = [
"rt-multi-thread",
Expand Down
2 changes: 1 addition & 1 deletion ladder_lib/src/proxy/vmess/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ mod tests {

info!("{:#?}", request);

futures::executor::block_on(async move {
tokio::runtime::Runtime::new().unwrap().block_on(async move {
let buffer = request.encode_aead(&id, time);
let (auth_id, data) = buffer.split_at(16);
let data = data.to_owned();
Expand Down
9 changes: 5 additions & 4 deletions rusty_ladder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty_ladder"
version = "0.1.6"
version = "0.1.7"
authors = ["reddal"]
edition = "2018"
license = "GPL-3.0"
Expand Down Expand Up @@ -121,14 +121,15 @@ serde_json = { version = "1.0", optional = true }
toml = { version = "0.5", optional = true }
structopt = "0.3"
log = { version = "0.4", default-features = false, features = [
"std",
"release_max_level_info",
"serde",
] }
tokio = { version = "1.0" }
tui = { version = "0.18", optional = true }
crossterm = { version = "0.23", optional = true }
futures = "0.3"
futures = { version = "0.3", default-features = false, features = [
"std",
"async-await"
] }
lazy_static = "1.4"
thiserror = "1.0"
smol_str = "0.1"
Expand Down
3 changes: 2 additions & 1 deletion rusty_ladder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,11 @@ mod tui_utils {
};
let (serve_task, abort_handle) = abortable(task);

let handle = rt.handle().clone();
// Spawn a thread to handle TUI
let tui_thread = {
thread::spawn(move || {
let res = tui::run(tui_receiver, tui::DEFAULT_UPDATE_INTERVAL, monitor);
let res = tui::run(tui_receiver, tui::DEFAULT_UPDATE_INTERVAL, monitor, handle);
// This error is caused by server thread panicking, so it's safe to ignore.
abort_handle.abort();
res
Expand Down
7 changes: 5 additions & 2 deletions rusty_ladder/src/tui/data_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ use super::ColumnIndex;
use ladder_lib::server::stat::{self, snapshot, Monitor, Snapshot};
use log::trace;
use std::cmp::Ordering;
use tokio::runtime::Handle;

pub(super) struct DataManager {
monitor: Monitor,
pub snapshots: Vec<Snapshot>,
rt: Handle,
}

impl DataManager {
pub fn new(monitor: Monitor) -> Self {
pub fn new(rt: Handle, monitor: Monitor) -> Self {
Self {
monitor,
snapshots: Vec::with_capacity(64),
rt,
}
}

Expand All @@ -40,7 +43,7 @@ impl DataManager {
{
let result = &mut self.snapshots;
let monitor = &self.monitor;
futures::executor::block_on(async {
self.rt.block_on(async {
// call async functions
monitor.query(&stat::Filter::new_all(), result);
});
Expand Down
3 changes: 2 additions & 1 deletion rusty_ladder/src/tui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pub fn run(
stop_receiver: mpsc::Receiver<()>,
update_interval: Duration,
monitor: Monitor,
rt: tokio::runtime::Handle,
) -> Result<(), BoxStdErr> {
setup_panic();
trace!(
Expand All @@ -113,7 +114,7 @@ pub fn run(
// let mut last_update_time = Instant::now();

let mut renderer = Renderer::new();
let mut data_manager = DataManager::new(monitor);
let mut data_manager = DataManager::new(rt, monitor);

let mut sort_column: Option<ColumnIndex> = None;

Expand Down

0 comments on commit 4f037e3

Please sign in to comment.