32 lines
655 B
Rust
32 lines
655 B
Rust
extern crate rand;
|
|
extern crate rouille;
|
|
|
|
use std::sync::Arc;
|
|
use std::thread;
|
|
|
|
mod http;
|
|
mod random_names;
|
|
mod smtp;
|
|
mod state;
|
|
|
|
fn main() {
|
|
println!("Starting on localhost:8005");
|
|
|
|
let state = state::fresh_state();
|
|
|
|
let http_state = Arc::clone(&state);
|
|
let http_thread = thread::spawn(move || {
|
|
rouille::start_server("localhost:8005", move |request| {
|
|
http::http_handler(request, &http_state)
|
|
})
|
|
});
|
|
|
|
let smtp_state = Arc::clone(&state);
|
|
let smtp_thread = thread::spawn(move || {
|
|
smtp::start_server(smtp_state);
|
|
});
|
|
|
|
http_thread.join().unwrap();
|
|
smtp_thread.join().unwrap();
|
|
}
|