commit
2b62d6f28d
4 changed files with 7 additions and 1349 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "irc"
|
name = "irc"
|
||||||
version = "0.13.1"
|
version = "0.13.2"
|
||||||
description = "A simple, thread-safe, and async-friendly library for IRC clients."
|
description = "A simple, thread-safe, and async-friendly library for IRC clients."
|
||||||
authors = ["Aaron Weiss <awe@pdgn.co>"]
|
authors = ["Aaron Weiss <awe@pdgn.co>"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
|
|
@ -711,15 +711,13 @@ impl IrcClient {
|
||||||
let (tx_incoming, rx_incoming) = oneshot::channel();
|
let (tx_incoming, rx_incoming) = oneshot::channel();
|
||||||
let (tx_view, rx_view) = oneshot::channel();
|
let (tx_view, rx_view) = oneshot::channel();
|
||||||
|
|
||||||
let mut reactor = Core::new()?;
|
let cfg = config.clone();
|
||||||
let handle = reactor.handle();
|
|
||||||
// Attempting to connect here (as opposed to on the thread) allows more errors to happen
|
|
||||||
// immediately, rather than to occur as panics on the thread. In particular, non-resolving
|
|
||||||
// server names, and failed SSL setups will appear here.
|
|
||||||
let conn = reactor.run(Connection::new(&config, &handle)?)?;
|
|
||||||
|
|
||||||
let _ = thread::spawn(move || {
|
let _ = thread::spawn(move || {
|
||||||
let mut reactor = Core::new().unwrap();
|
let mut reactor = Core::new().unwrap();
|
||||||
|
// Setting up internal processing stuffs.
|
||||||
|
let handle = reactor.handle();
|
||||||
|
let conn = reactor.run(Connection::new(&cfg, &handle).unwrap()).unwrap();
|
||||||
|
|
||||||
tx_view.send(conn.log_view()).unwrap();
|
tx_view.send(conn.log_view()).unwrap();
|
||||||
let (sink, stream) = conn.split();
|
let (sink, stream) = conn.split();
|
||||||
|
|
|
@ -177,7 +177,8 @@ impl IrcReactor {
|
||||||
/// # let config = Config::default();
|
/// # let config = Config::default();
|
||||||
/// let mut reactor = IrcReactor::new().unwrap();
|
/// let mut reactor = IrcReactor::new().unwrap();
|
||||||
/// let client = reactor.prepare_client_and_connect(&config).unwrap();
|
/// let client = reactor.prepare_client_and_connect(&config).unwrap();
|
||||||
/// reactor.register_client_with_handler(client, process_msg)
|
/// reactor.register_client_with_handler(client, process_msg);
|
||||||
|
/// reactor.run().unwrap();
|
||||||
/// # }
|
/// # }
|
||||||
/// # fn process_msg(client: &IrcClient, message: Message) -> error::Result<()> { Ok(()) }
|
/// # fn process_msg(client: &IrcClient, message: Message) -> error::Result<()> { Ok(()) }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue