summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Wolff <janw@mailbox.org>2020-05-19 07:25:03 +0200
committerJan Wolff <janw@mailbox.org>2020-05-19 07:25:03 +0200
commitb6e428eba2397ab063f6580098fe100906c44fb1 (patch)
tree967a5c6a48bd8f10458250d57a0b5f5d014e78be /src
parent710e8aae565bd376d493ed89859c52d7f58a34f7 (diff)
more documentation
Diffstat (limited to 'src')
-rw-r--r--src/main.rs13
-rw-r--r--src/server/mod.rs8
2 files changed, 14 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index b22b626..1a00173 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,12 +6,8 @@ use std::io::{BufRead, BufReader};
use std::path::Path;
fn help() {
- let version = match option_env!("CARGO_PKG_VERSION") {
- Some(v) => v,
- None => "",
- };
-
- println!("usage: sheldond {}", version);
+ println!("usage:");
+ println!(" -h, --help\t\tdisplay this message");
println!(" -c, --config\t\tpath to the configuration file");
}
@@ -83,6 +79,11 @@ fn parse_config(fname: String) -> server::ServerConfig {
}
fn main() {
+ println!("sheldond {}", match option_env!("CARGO_PKG_VERSION") {
+ Some(v) => v,
+ None => "",
+ });
+
let config_fname = match parse_args() {
Some(config_fname) => config_fname,
None => {
diff --git a/src/server/mod.rs b/src/server/mod.rs
index 3b01ce2..9909fd2 100644
--- a/src/server/mod.rs
+++ b/src/server/mod.rs
@@ -97,9 +97,12 @@ impl Server {
fn build_acceptor(config: &ServerConfig) -> std::sync::Arc<SslAcceptor> {
let mut acceptor = SslAcceptor::mozilla_intermediate_v5(SslMethod::tls()).unwrap();
+ println!("reading certificate private key: {}", config.cert_key);
+ // TODO: allow more than PEM
acceptor
.set_private_key_file(config.cert_key.as_str(), SslFiletype::PEM)
.unwrap();
+ println!("reading certificate chain file: {}", config.cert_chain);
acceptor
.set_certificate_chain_file(config.cert_chain.as_str())
.unwrap();
@@ -146,9 +149,12 @@ impl Server {
thread::spawn(move || {
let stream = acceptor.accept(stream).unwrap();
handler::handle_request(&config, stream);
+ println!("closing connection");
});
}
- Err(_) => { /* connection failed */ }
+ Err(_) => {
+ println!("connection failed");
+ }
}
}
}