mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-11-06 16:14:11 +00:00
fixed some bugs
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
|
||||
name = "shadowsocks-rust"
|
||||
version = "0.9.9"
|
||||
version = "0.9.10"
|
||||
authors = ["Y. T. CHUNG <zonyitoo@gmail.com>"]
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -218,7 +218,6 @@ impl Clone for OpenSSLDigest {
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for OpenSSLDigest {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
@@ -403,7 +402,6 @@ impl Clone for OpenSSLCrypto {
|
||||
}
|
||||
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for OpenSSLCrypto {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
#![crate_type = "lib"]
|
||||
#![crate_name = "shadowsocks"]
|
||||
|
||||
#![feature(unsafe_destructor, box_syntax, libc, core, tcp, collections, test, slice_patterns, lookup_host, convert, scoped)]
|
||||
#![feature(box_syntax, libc, core, tcp, collections, test, slice_patterns, lookup_host, convert, buf_stream)]
|
||||
|
||||
extern crate rustc_serialize as serialize;
|
||||
#[macro_use]
|
||||
|
||||
+5
-9
@@ -90,12 +90,10 @@ impl Relay for RelayLocal {
|
||||
warn!("UDP relay feature is disabled, recompile with feature=\"enable-udp\" to enable this feature");
|
||||
}
|
||||
let tcprelay = self.tcprelay.clone();
|
||||
let tcp_thread = thread::scoped(move || tcprelay.run());
|
||||
let tcp_thread = thread::spawn(move || tcprelay.run());
|
||||
info!("Enabled TCP relay");
|
||||
|
||||
tcp_thread.join();
|
||||
|
||||
panic!("Exit!!");
|
||||
tcp_thread.join().unwrap();
|
||||
}
|
||||
|
||||
#[cfg(feature = "enable-udp")]
|
||||
@@ -103,21 +101,19 @@ impl Relay for RelayLocal {
|
||||
let mut threads = Vec::with_capacity(2);
|
||||
|
||||
let tcprelay = self.tcprelay.clone();
|
||||
let tcp_thread = thread::scoped(move || tcprelay.run());
|
||||
let tcp_thread = thread::spawn(move || tcprelay.run());
|
||||
threads.push(tcp_thread);
|
||||
info!("Enabled TCP relay");
|
||||
|
||||
if self.enable_udp {
|
||||
let udprelay = self.udprelay.clone();
|
||||
let udp_thread = thread::scoped(move || udprelay.run());
|
||||
let udp_thread = thread::spawn(move || udprelay.run());
|
||||
threads.push(udp_thread);
|
||||
info!("Enabled UDP relay");
|
||||
}
|
||||
|
||||
for fut in threads.into_iter() {
|
||||
fut.join();
|
||||
fut.join().unwrap();
|
||||
}
|
||||
|
||||
panic!("Exit!!");
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -89,18 +89,18 @@ impl Relay for RelayServer {
|
||||
let mut threads = Vec::with_capacity(2);
|
||||
|
||||
let tcprelay = self.tcprelay.clone();
|
||||
threads.push(thread::scoped(move || tcprelay.run()));
|
||||
threads.push(thread::spawn(move || tcprelay.run()));
|
||||
info!("Enabled TCP relay");
|
||||
|
||||
if self.enable_udp {
|
||||
let udprelay = self.udprelay.clone();
|
||||
let udp_thread = thread::scoped(move || udprelay.run());
|
||||
let udp_thread = thread::spawn(move || udprelay.run());
|
||||
threads.push(udp_thread);
|
||||
info!("Enabled UDP relay");
|
||||
}
|
||||
|
||||
for fut in threads.into_iter() {
|
||||
fut.join();
|
||||
fut.join().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,9 +111,9 @@ impl Relay for RelayServer {
|
||||
}
|
||||
|
||||
let tcprelay = self.tcprelay.clone();
|
||||
let tcp_thread = thread::scoped(move || tcprelay.run());
|
||||
let tcp_thread = thread::spawn(move || tcprelay.run());
|
||||
info!("Enabled TCP relay");
|
||||
|
||||
tcp_thread.join();
|
||||
tcp_thread.join().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,14 +167,14 @@ impl Relay for TcpRelayServer {
|
||||
let mut threads = Vec::new();
|
||||
for s in self.config.server.iter() {
|
||||
let s = s.clone();
|
||||
let fut = thread::Builder::new().name(format!("TCP relay of `{}:{}`", s.addr, s.port)).scoped(move || {
|
||||
let fut = thread::Builder::new().name(format!("TCP relay of `{}:{}`", s.addr, s.port)).spawn(move || {
|
||||
TcpRelayServer::accept_loop(s);
|
||||
}).unwrap();
|
||||
threads.push(fut);
|
||||
}
|
||||
|
||||
for fut in threads.into_iter() {
|
||||
fut.join();
|
||||
fut.join().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,6 @@ impl<W: Write> Write for EncryptedWriter<W> {
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl<W: Write> Drop for EncryptedWriter<W> {
|
||||
fn drop(&mut self) {
|
||||
self.finalize().unwrap()
|
||||
|
||||
@@ -183,12 +183,12 @@ impl Relay for UdpRelayServer {
|
||||
let mut threads = Vec::new();
|
||||
for s in self.config.server.iter() {
|
||||
let s = s.clone();
|
||||
let fut = thread::scoped(move || UdpRelayServer::accept_loop(s));
|
||||
let fut = thread::spawn(move || UdpRelayServer::accept_loop(s));
|
||||
threads.push(fut);
|
||||
}
|
||||
|
||||
for fut in threads.into_iter() {
|
||||
fut.join();
|
||||
fut.join().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user