Refactor IrcClientFuture and ConnectionFuture to own the config

This commit refactors IrcClientFuture and ConnectionFuture to own
the config instead of holding a reference.

This is required for reconnecting in dynamic contexts.
This is not possible with the old API, because Config is a reference,
requiring the value to live for the whole execution of the reactor.
This commit is contained in:
Christoph Herzog 2018-10-04 00:35:42 +02:00
parent 0534ab061f
commit 2aff64b645
8 changed files with 39 additions and 41 deletions

View file

@ -26,7 +26,7 @@ fn main() {
for config in configs {
// Immediate errors like failure to resolve the server's domain or to establish any connection will
// manifest here in the result of prepare_client_and_connect.
let client = reactor.prepare_client_and_connect(&config).unwrap();
let client = reactor.prepare_client_and_connect(config).unwrap();
client.identify().unwrap();
// Here, we tell the reactor to setup this client for future handling (in run) using the specified
// handler function process_msg.