ngx-export 0.9.0.0 → 0.9.1.0
raw patch · 3 files changed
+32/−22 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Changelog.md +4/−0
- NgxExport.hs +27/−21
- ngx-export.cabal +1/−1
Changelog.md view
@@ -1,3 +1,7 @@+### 0.9.1.0++- Do not write into service event channel when Nginx is exiting.+ ### 0.9.0.0 - Using interruptible FFI for safeWaitToSetLock to re-enable graceful shutdown
NgxExport.hs view
@@ -389,9 +389,15 @@ pokeCStringLen x l p pl return 1 -safeYYHandler :: IO (L.ByteString, CUInt) -> IO (L.ByteString, CUInt)+safeYYHandler :: IO (L.ByteString, (CUInt, Bool)) ->+ IO (L.ByteString, (CUInt, Bool)) safeYYHandler = handle $ \e ->- return (C8L.pack $ show (e :: SomeException), 1)+ return (C8L.pack $ show e,+ (1, case asyncExceptionFromException e of+ Nothing -> False+ Just ae -> ae == ThreadKilled+ )+ ) {-# INLINE safeYYHandler #-} isEINTR :: IOError -> Bool@@ -430,8 +436,8 @@ Ptr (Ptr NgxStrType) -> Ptr CInt -> Ptr (StablePtr L.ByteString) -> IO CUInt yY f x (I n) p pl spd = do- (s, r) <- safeYYHandler $- flip (,) 0 . f <$> B.unsafePackCStringLen (x, n)+ (s, (r, _)) <- safeYYHandler $+ flip (,) (0, False) . f <$> B.unsafePackCStringLen (x, n) pokeLazyByteString s p pl spd return r @@ -439,9 +445,9 @@ Ptr (Ptr NgxStrType) -> Ptr CInt -> Ptr (StablePtr L.ByteString) -> IO CUInt ioyY f x (I n) p pl spd = do- (s, r) <- safeYYHandler $ do+ (s, (r, _)) <- safeYYHandler $ do s <- B.unsafePackCStringLen (x, n) >>= flip f False- fmap (flip (,) 0) $ return $! s+ fmap (flip (,) (0, False)) $ return $! s pokeLazyByteString s p pl spd return r @@ -457,17 +463,20 @@ asyncIOCommon a (I fd) efd p pl pr spd = async (do- (s, r) <- safeYYHandler $ do+ (s, (r, exiting)) <- safeYYHandler $ do s <- a- fmap (flip (,) 0) $ return $! s+ fmap (flip (,) (0, False)) $ return $! s pokeLazyByteString s p pl spd poke pr r- uninterruptibleMask_ $- if efd- then writeFlag8b- else writeFlag1b >> closeFd fd `catchIOError` const (return ())+ if exiting+ then unless efd closeChannel+ else uninterruptibleMask_ $+ if efd+ then writeFlag8b+ else writeFlag1b >> closeChannel ) >>= newStablePtr- where writeBufN n s = iterateUntilM (>= n)+ where writeBufN n s = void $+ iterateUntilM (>= n) (\w -> (w +) <$> fdWriteBuf fd (plusPtr s $ fromIntegral w) (n - w) `catchIOError`@@ -476,8 +485,9 @@ else n ) ) 0- writeFlag1b = void $ B.unsafeUseAsCString asyncIOFlag1b $ writeBufN 1- writeFlag8b = void $ B.unsafeUseAsCString asyncIOFlag8b $ writeBufN 8+ writeFlag1b = B.unsafeUseAsCString asyncIOFlag1b $ writeBufN 1+ writeFlag8b = B.unsafeUseAsCString asyncIOFlag8b $ writeBufN 8+ closeChannel = closeFd fd `catchIOError` const (return ()) asyncIOYY :: IOYY -> CString -> CInt -> CInt -> CInt -> CUInt -> CUInt -> Ptr (Ptr NgxStrType) -> Ptr CInt ->@@ -493,12 +503,8 @@ return (True, False) ) `catches`- [E.Handler- ((\e -> return (not (isEINTR e), False)) ::- IOError -> IO (Bool, Bool))- ,E.Handler- ((\e -> return (True, e == ThreadKilled)) ::- AsyncException -> IO (Bool, Bool))+ [E.Handler $ return . flip (,) False . not . isEINTR+ ,E.Handler $ return . (,) True . (== ThreadKilled) ] else return False if exiting
ngx-export.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-version: 0.9.0.0+version: 0.9.1.0 synopsis: Helper module for Nginx haskell module description: Helper module for <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>