Merge pull request #173 from dgriffen/dev/dgriffen/non-sequential-handler
spawn handler futures on the reactor
This commit is contained in:
commit
48b5adf33b
1 changed files with 4 additions and 1 deletions
|
@ -141,8 +141,11 @@ impl IrcReactor {
|
|||
&mut self, client: IrcClient, mut handler: F
|
||||
) where F: FnMut(&IrcClient, Message) -> U + 'static,
|
||||
U: IntoFuture<Item = (), Error = error::IrcError> + 'static {
|
||||
let handle = self.inner.handle().clone();
|
||||
self.handlers.push(Box::new(client.stream().for_each(move |message| {
|
||||
handler(&client, message)
|
||||
handle.spawn(handler(&client, message).into_future().map_err(|_| (())));
|
||||
|
||||
Ok(())
|
||||
})));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue