Fixed the clean killing of plugin's threads, fixed exception management and cleaned plugins' main functions.
This commit is contained in:
parent
416460886d
commit
bfc06f1ff1
7 changed files with 27 additions and 33 deletions
|
@ -3,7 +3,9 @@ module Plugins.Ping
|
|||
) where
|
||||
|
||||
import Control.Concurrent.Chan
|
||||
import Control.Exception
|
||||
import Control.Monad.State
|
||||
import Prelude hiding (catch)
|
||||
|
||||
import Hsbot.IRCPlugin
|
||||
import Hsbot.Types
|
||||
|
@ -12,7 +14,7 @@ import Hsbot.Types
|
|||
mainPing :: Chan BotMsg -> Chan BotMsg -> IO ()
|
||||
mainPing serverChan chan = do
|
||||
let plugin = PluginInstance "Ping" serverChan chan
|
||||
(runStateT run plugin) `catch` (const $ return ((), plugin))
|
||||
(execStateT run plugin) `catch` (\(ex :: AsyncException) -> return plugin)
|
||||
return ()
|
||||
|
||||
-- | The IrcPlugin monad main function
|
||||
|
|
Reference in a new issue