Skip to content

Commit 45e8bc6

Browse files
committed
Upgrade trust-dns to alpha.3 and bump version to v1.8.0-alpha.3
1 parent d0af887 commit 45e8bc6

File tree

13 files changed

+260
-191
lines changed

13 files changed

+260
-191
lines changed

Cargo.lock

Lines changed: 27 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "shadowsocks-rust"
3-
version = "1.8.0-alpha.2"
3+
version = "1.8.0-alpha.3"
44
authors = ["Y. T. CHUNG <zonyitoo@gmail.com>"]
55
description = "shadowsocks is a fast tunnel proxy that helps you bypass firewalls."
66
repository = "https://github.com/zonyitoo/shadowsocks-rust"

src/bin/local.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@ use futures::{
1111
};
1212
use log::{debug, error, info};
1313
use std::net::SocketAddr;
14-
use tokio;
14+
use tokio::runtime::Builder;
1515

1616
use shadowsocks::{plugin::PluginConfig, run_local, Config, ConfigType, Mode, ServerAddr, ServerConfig};
1717

1818
mod logging;
1919
mod monitor;
2020

21-
#[cfg_attr(feature = "single-threaded", tokio::main(basic_scheduler))]
22-
#[cfg_attr(not(feature = "single-threaded"), tokio::main)]
23-
async fn main() {
21+
fn main() {
2422
let matches = App::new("shadowsocks")
2523
.version(shadowsocks::VERSION)
2624
.about("A fast tunnel proxy that helps you bypass firewalls.")
@@ -208,11 +206,21 @@ async fn main() {
208206

209207
debug!("Config: {:?}", config);
210208

211-
let abort_signal = monitor::create_signal_monitor();
212-
match future::select(run_local(config).boxed(), abort_signal.boxed()).await {
213-
// Server future resolved without an error. This should never happen.
214-
Either::Left(_) => panic!("Server exited unexpectly"),
215-
// The abort signal future resolved. Means we should just exit.
216-
Either::Right(_) => (),
209+
let mut builder = Builder::new();
210+
if cfg!(feature = "single-threaded") {
211+
builder.basic_scheduler();
212+
} else {
213+
builder.threaded_scheduler();
217214
}
215+
let mut runtime = builder.enable_all().build().expect("Unable to create Tokio Runtime");
216+
let rt_handle = runtime.handle().clone();
217+
runtime.block_on(async move {
218+
let abort_signal = monitor::create_signal_monitor();
219+
match future::select(run_local(config, rt_handle).boxed(), abort_signal.boxed()).await {
220+
// Server future resolved without an error. This should never happen.
221+
Either::Left(_) => panic!("Server exited unexpectly"),
222+
// The abort signal future resolved. Means we should just exit.
223+
Either::Right(_) => (),
224+
}
225+
})
218226
}

src/bin/server.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@ use futures::{
1313
FutureExt,
1414
};
1515
use log::{debug, error, info};
16-
use tokio;
16+
use tokio::runtime::Builder;
1717

1818
use shadowsocks::{plugin::PluginConfig, run_server, Config, ConfigType, Mode, ServerAddr, ServerConfig};
1919

2020
mod logging;
2121
mod monitor;
2222

23-
#[cfg_attr(feature = "single-threaded", tokio::main(basic_scheduler))]
24-
#[cfg_attr(not(feature = "single-threaded"), tokio::main)]
25-
async fn main() {
23+
fn main() {
2624
let matches = App::new("shadowsocks")
2725
.version(shadowsocks::VERSION)
2826
.about("A fast tunnel proxy that helps you bypass firewalls.")
@@ -191,11 +189,22 @@ async fn main() {
191189

192190
debug!("Config: {:?}", config);
193191

194-
let abort_signal = monitor::create_signal_monitor();
195-
match future::select(run_server(config).boxed(), abort_signal.boxed()).await {
196-
// Server future resolved without an error. This should never happen.
197-
Either::Left(_) => panic!("Server exited unexpectly"),
198-
// The abort signal future resolved. Means we should just exit.
199-
Either::Right(_) => (),
192+
let mut builder = Builder::new();
193+
if cfg!(feature = "single-threaded") {
194+
builder.basic_scheduler();
195+
} else {
196+
builder.threaded_scheduler();
200197
}
198+
let mut runtime = builder.enable_all().build().expect("Unable to create Tokio Runtime");
199+
let rt_handle = runtime.handle().clone();
200+
201+
runtime.block_on(async move {
202+
let abort_signal = monitor::create_signal_monitor();
203+
match future::select(run_server(config, rt_handle).boxed(), abort_signal.boxed()).await {
204+
// Server future resolved without an error. This should never happen.
205+
Either::Left(_) => panic!("Server exited unexpectly"),
206+
// The abort signal future resolved. Means we should just exit.
207+
Either::Right(_) => (),
208+
}
209+
})
201210
}

src/bin/tunnel.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use futures::{
1111
};
1212
use log::{debug, error, info};
1313
use std::net::SocketAddr;
14-
use tokio;
14+
use tokio::runtime::Builder;
1515

1616
use shadowsocks::{
1717
plugin::PluginConfig,
@@ -27,9 +27,7 @@ use shadowsocks::{
2727
mod logging;
2828
mod monitor;
2929

30-
#[cfg_attr(feature = "single-threaded", tokio::main(basic_scheduler))]
31-
#[cfg_attr(not(feature = "single-threaded"), tokio::main)]
32-
async fn main() {
30+
fn main() {
3331
let matches = App::new("shadowsocks")
3432
.version(shadowsocks::VERSION)
3533
.about("A fast tunnel proxy that helps you bypass firewalls.")
@@ -230,11 +228,22 @@ async fn main() {
230228

231229
debug!("Config: {:?}", config);
232230

233-
let abort_signal = monitor::create_signal_monitor();
234-
match future::select(run_local(config).boxed(), abort_signal.boxed()).await {
235-
// Server future resolved without an error. This should never happen.
236-
Either::Left(_) => panic!("Server exited unexpectly"),
237-
// The abort signal future resolved. Means we should just exit.
238-
Either::Right(_) => (),
231+
let mut builder = Builder::new();
232+
if cfg!(feature = "single-threaded") {
233+
builder.basic_scheduler();
234+
} else {
235+
builder.threaded_scheduler();
239236
}
237+
let mut runtime = builder.enable_all().build().expect("Unable to create Tokio Runtime");
238+
let rt_handle = runtime.handle().clone();
239+
240+
runtime.block_on(async move {
241+
let abort_signal = monitor::create_signal_monitor();
242+
match future::select(run_local(config, rt_handle).boxed(), abort_signal.boxed()).await {
243+
// Server future resolved without an error. This should never happen.
244+
Either::Left(_) => panic!("Server exited unexpectly"),
245+
// The abort signal future resolved. Means we should just exit.
246+
Either::Right(_) => (),
247+
}
248+
})
240249
}

0 commit comments

Comments
 (0)