From ca55fbf8616c767c5c8593a768d07289731d573a Mon Sep 17 00:00:00 2001 From: Austin Hellyer Date: Sun, 6 Nov 2016 12:06:03 -0800 Subject: Fix framework locking on MessageCreate dispatch The framework will lock on checking if it's initialized, and will not be able to unlock a second time from within the same scope. Fix this by unlocking it once and binding it. --- src/client/dispatch.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/client/dispatch.rs') diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs index 9a7fc2d..92f3624 100644 --- a/src/client/dispatch.rs +++ b/src/client/dispatch.rs @@ -417,13 +417,14 @@ pub fn dispatch(event: Result, let context = context(Some(event.message.channel_id), conn, login_type); + let mut framework = framework.lock().expect("framework poisoned"); - if framework.lock().unwrap().initialized { + if framework.initialized { dispatch_message(context.clone(), event.message.clone(), event_store); - framework.lock().unwrap().dispatch(context, event.message); + framework.dispatch(context, event.message); } else { dispatch_message(context, event.message, event_store); } -- cgit v1.2.3