diff options
Diffstat (limited to 'src/server.rs')
-rw-r--r-- | src/server.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/server.rs b/src/server.rs index cb57499..cedcf8c 100644 --- a/src/server.rs +++ b/src/server.rs @@ -123,23 +123,28 @@ fn run_server(path: &str, is_recv: bool, recursive: bool, daemonize: bool, no_cr info!("Got connection from {}", socket.getpeername().unwrap()); let mut stream: UdtStream = UdtStream::new(socket); + let io_result: io::Result<()>; if !no_crypto { let mut stream = SecretStream::new(stream); stream.key = secret_key; stream.read_nonce = read_nonce; stream.write_nonce = write_nonce; if is_recv { - common::sink_files(&mut stream, path, recursive) + io_result = common::sink_files(&mut stream, path, recursive) } else { - common::source_files(&mut stream, path, recursive) + io_result = common::source_files(&mut stream, path, recursive) } } else { if is_recv { - common::sink_files(&mut stream, path, recursive) + io_result = common::sink_files(&mut stream, path, recursive) } else { - common::source_files(&mut stream, path, recursive) + io_result = common::source_files(&mut stream, path, recursive) } } + match io_result { + Ok(_) => Ok(()), + Err(e) => Err(e.description().to_string()), + } } fn usage_server(opts: Options) { |