diff --git a/examples/nothreads.rs b/examples/nothreads.rs index fbec2e1..b513946 100644 --- a/examples/nothreads.rs +++ b/examples/nothreads.rs @@ -24,11 +24,16 @@ fn main() { let mut reactor = IrcReactor::new().unwrap(); for config in configs { + // Immediate errors like failure to resolve the server's name or to establish any connection will + // manifest here in the result of prepare_server_and_connect. let server = reactor.prepare_server_and_connect(&config).unwrap(); server.identify().unwrap(); + // Here, we tell the reactor to setup this server for future handling (in run) using the specified + // handler function process_msg. reactor.register_server_with_handler(server, process_msg); } + // Runtime errors like a dropped connection will manifest here in the result of run. reactor.run().unwrap(); } diff --git a/examples/reconnector.rs b/examples/reconnector.rs index b3270b5..0a29be5 100644 --- a/examples/reconnector.rs +++ b/examples/reconnector.rs @@ -36,7 +36,9 @@ fn main() { }).and_then(|()| reactor.run()); match res { + // The connections ended normally (for example, they sent a QUIT message to the server). Ok(_) => break, + // Something went wrong! We'll print the error, and restart the connections. Err(e) => eprintln!("{}", e), } }