diff --git a/src/client/reactor.rs b/src/client/reactor.rs index 34bf937..7bc26fa 100644 --- a/src/client/reactor.rs +++ b/src/client/reactor.rs @@ -141,8 +141,11 @@ impl IrcReactor { &mut self, client: IrcClient, mut handler: F ) where F: FnMut(&IrcClient, Message) -> U + 'static, U: IntoFuture + '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(()) }))); }