packages feed

irc-client 0.4.2.0 → 0.4.2.1

raw patch · 3 files changed

+17/−9 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Network/IRC/Client.hs view
@@ -136,7 +136,7 @@   , _realname      = n   , _password      = Nothing   , _channels      = []-  , _ctcpVer       = "irc-client-0.4.2.0"+  , _ctcpVer       = "irc-client-0.4.2.1"   , _eventHandlers = defaultEventHandlers   , _ignore        = []   }
Network/IRC/Client/Internal.hs view
@@ -12,14 +12,14 @@ import Control.Concurrent         (forkIO) import Control.Concurrent.STM     (atomically, readTVar, retry, writeTVar) import Control.Exception          (SomeException, catch, throwIO)-import Control.Monad              (unless)+import Control.Monad              (unless, when) import Control.Monad.IO.Class     (MonadIO, liftIO) import Control.Monad.Trans.Reader (runReaderT) import Data.ByteString            (ByteString) import Data.Conduit               (Producer, Conduit, Consumer, (=$=), ($=), (=$), await, awaitForever, toProducer, yield) import Data.Conduit.TMChan        (closeTBMChan, isEmptyTBMChan, newTBMChanIO, sourceTBMChan, writeTBMChan) import Data.Text.Encoding         (decodeUtf8, encodeUtf8)-import Data.Time.Clock            (NominalDiffTime, getCurrentTime)+import Data.Time.Clock            (NominalDiffTime, addUTCTime, getCurrentTime) import Data.Time.Format           (formatTime) import Network.IRC.Conduit        (IrcEvent, IrcMessage, floodProtector, rawMessage, toByteString) import Network.IRC.Client.Types@@ -208,11 +208,9 @@       -- Set the state to @Disconnecting@       liftIO . atomically $ writeTVar (_connState s) Disconnecting -      -- Wait for all messages to be sent+      -- Wait for all messages to be sent, or a minute has passed.       queueS <- _sendqueue <$> connectionConfig-      liftIO . atomically $ do-        empty <- isEmptyTBMChan queueS-        unless empty retry+      timeout 60 . atomically $ isEmptyTBMChan queueS        -- Then close the connection       disconnectNow@@ -228,3 +226,13 @@    s <- ircState   liftIO . atomically $ writeTVar (_connState s) Disconnected++-- | Block until an action is successful or a timeout is reached.+timeout :: MonadIO m => NominalDiffTime -> IO Bool -> m ()+timeout dt check = liftIO $ do+  finish <- addUTCTime dt <$> getCurrentTime+  let wait = do+        now  <- getCurrentTime+        cond <- check+        when (now < finish && not cond) wait+  wait
irc-client.cabal view
@@ -10,7 +10,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.4.2.0+version:             0.4.2.1  -- A short (one-line) description of the package. synopsis:            An IRC client library.@@ -107,4 +107,4 @@ source-repository this   type:     git   location: https://github.com/barrucadu/irc-client.git-  tag:      0.4.2.0+  tag:      0.4.2.1