updated output and doc

This commit is contained in:
Y. T. Chung
2014-10-24 21:42:19 +08:00
parent 34fbefb13a
commit aa440a2fab
3 changed files with 15 additions and 11 deletions

View File

@@ -86,6 +86,9 @@ ssserver -c config.json
List all available arguments with `-h`.
Default log level is `error`, override it by setting environment variable `RUST_LOG`. Please refer
to [log crate](http://doc.rust-lang.org/log/index.html) for more detail.
## Notes
Still under developing and waiting for the final release of rust-1.0.

View File

@@ -28,7 +28,7 @@ extern crate log;
use std::sync::Arc;
use std::io::{Listener, TcpListener, Acceptor, TcpStream};
use std::io::{EndOfFile, TimedOut, NotConnected,
ConnectionFailed, ConnectionRefused, ConnectionReset, ConnectionAborted};
ConnectionFailed, ConnectionRefused, ConnectionReset, ConnectionAborted, BrokenPipe};
use std::io::net::ip::Port;
use std::io::net::ip::{Ipv4Addr, Ipv6Addr};
@@ -104,7 +104,7 @@ impl TcpRelayLocal {
Ok(..) => {},
Err(err) => {
match err.kind {
EndOfFile | TimedOut => {},
EndOfFile | TimedOut | BrokenPipe => {},
_ => {
error!("Error occurs while writing to remote stream: {}", err);
}
@@ -123,7 +123,7 @@ impl TcpRelayLocal {
},
Err(err) => {
match err.kind {
EndOfFile | TimedOut => {},
EndOfFile | TimedOut | BrokenPipe => {},
_ => {
error!("Error occurs while reading from local stream: {}", err);
}
@@ -160,7 +160,7 @@ impl TcpRelayLocal {
Ok(..) => {},
Err(err) => {
match err.kind {
EndOfFile | TimedOut => {},
EndOfFile | TimedOut | BrokenPipe => {},
_ => {
error!("Error occurs while writing to local stream: {}", err);
}
@@ -179,7 +179,7 @@ impl TcpRelayLocal {
},
Err(err) => {
match err.kind {
EndOfFile | TimedOut => {},
EndOfFile | TimedOut | BrokenPipe => {},
_ => {
error!("Error occurs while reading from remote stream: {}", err);
}

View File

@@ -27,7 +27,7 @@ extern crate log;
use std::sync::Arc;
use std::io::{Listener, TcpListener, Acceptor, TcpStream};
use std::io::net::ip::{Port, IpAddr};
use std::io::{EndOfFile, TimedOut};
use std::io::{EndOfFile, TimedOut, BrokenPipe};
use config::{Config, SingleServer, MultipleServer};
use relay::Relay;
@@ -90,7 +90,7 @@ impl TcpRelayServer {
Ok(..) => {},
Err(err) => {
match err.kind {
EndOfFile | TimedOut => {},
EndOfFile | TimedOut | BrokenPipe => {},
_ => {
error!("Error occurs while writing to local stream: {}", err);
}
@@ -102,7 +102,7 @@ impl TcpRelayServer {
},
Err(err) => {
match err.kind {
EndOfFile | TimedOut => {},
EndOfFile | TimedOut | BrokenPipe => {},
_ => {
error!("Error occurs while reading from remote stream: {}", err);
}
@@ -127,7 +127,7 @@ impl TcpRelayServer {
},
Err(err) => {
match err.kind {
EndOfFile | TimedOut => {},
EndOfFile | TimedOut | BrokenPipe => {},
_ => {
error!("Error occurs while reading from client stream: {}", err);
}
@@ -185,8 +185,9 @@ impl Relay for TcpRelayServer {
let (_, addr) = match parse_request_header(header.as_slice()) {
Ok((header_len, addr)) => (header_len, addr),
Err(err_code) => {
fail!("Error occurs while parsing request header: {}", err_code);
Err(..) => {
fail!("Error occurs while parsing request header, \
maybe wrong crypto method or password");
}
};
info!("Connecting to {}", addr);