From 971a386ca0b778b445fec393ce38064f4a1d8588 Mon Sep 17 00:00:00 2001 From: Daniel Griffen Date: Wed, 9 Jan 2019 20:18:38 -0800 Subject: [PATCH] spawn handler futures on the reactor --- src/client/reactor.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(()) }))); }