ngx-export 0.3.2.2 → 0.4.0.0
raw patch · 3 files changed
+37/−15 lines, 3 filesdep +binaryPVP ok
version bump matches the API change (PVP)
Dependencies added: binary
API changes (from Hackage documentation)
Files
- Changelog.md +5/−0
- NgxExport.hs +30/−14
- ngx-export.cabal +2/−1
Changelog.md view
@@ -1,3 +1,8 @@+### 0.4.0.0++- all asynchronous handlers can now report events via eventfd channels+- new dependency on package *binary* (>= 0.8.1.0)+ ### 0.3.2.2 - stricter constraints for packages *base* (>= 4.8 && < 5) and
NgxExport.hs view
@@ -54,6 +54,7 @@ import qualified Data.ByteString.Unsafe as B import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy.Char8 as C8L+import Data.Binary.Put import Paths_ngx_export (version) import Data.Version @@ -178,8 +179,8 @@ -- for using in directive /haskell_run_async/. ngxExportAsyncIOYY = ngxExportC 'IOYY 'asyncIOYY- [t|CString -> CInt ->- CInt -> CUInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()|]+ [t|CString -> CInt -> CInt -> CUInt -> CUInt ->+ Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()|] -- | Exports a function of type -- /'L.ByteString' -> 'B.ByteString' -> 'IO' 'L.ByteString'/@@ -190,7 +191,7 @@ ngxExportAsyncOnReqBody = ngxExport 'IOYYY 'asyncIOYYY [t|Ptr NgxStrType -> CInt -> CString -> CInt ->- CInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()|]+ CInt -> CUInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()|] -- | Exports a function of type -- /'B.ByteString' -> 'Bool' -> 'IO' 'L.ByteString'/@@ -200,8 +201,8 @@ -- being run for the first time. ngxExportServiceIOYY = ngxExport 'IOYY 'asyncIOYY- [t|CString -> CInt ->- CInt -> CUInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()|]+ [t|CString -> CInt -> CInt -> CUInt -> CUInt ->+ Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()|] -- | Exports a function of type -- /'B.ByteString' -> ('L.ByteString', 'String', 'Int')/@@ -359,9 +360,15 @@ `catch` \e -> return $ C8L.pack $ show (e :: SomeException) pokeLazyByteString s p +asyncIOFlag1b :: B.ByteString+asyncIOFlag1b = L.toStrict $ runPut $ putInt8 1++asyncIOFlag8b :: B.ByteString+asyncIOFlag8b = L.toStrict $ runPut $ putInt64host 1+ asyncIOCommon :: IO C8L.ByteString ->- CInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()-asyncIOCommon a (I fd) p pl r = void . async $+ CInt -> Bool -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()+asyncIOCommon a (I fd) efd p pl r = void . async $ ((Right <$> a) `catch` (\e -> return $ Left $ show (e :: SomeException)) >>= either@@ -376,20 +383,29 @@ poke r 0 ) )- `finally` ((fdWrite fd "0" >> closeFd fd) `catchIOError` const (return ()))+ `finally`+ ((if efd+ then void $ B.unsafeUseAsCString asyncIOFlag8b+ (\(castPtr -> s) -> fdWriteBuf fd s 8)+ else B.unsafeUseAsCString asyncIOFlag1b+ (\(castPtr -> s) -> fdWriteBuf fd s 1) >> closeFd fd+ ) `catchIOError` const (return ())+ ) asyncIOYY :: NgxExport -> CString -> CInt ->- CInt -> CUInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()-asyncIOYY (IOYY f) x (I n) fd ((/= 0) -> fstRun) =- asyncIOCommon (B.unsafePackCStringLen (x, n) >>= flip f fstRun) fd+ CInt -> CUInt -> CUInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()+asyncIOYY (IOYY f) x (I n) fd ((/= 0) -> efd) ((/= 0) -> fstRun) =+ asyncIOCommon (B.unsafePackCStringLen (x, n) >>= flip f fstRun) fd efd asyncIOYYY :: NgxExport -> Ptr NgxStrType -> CInt -> CString -> CInt ->- CInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()-asyncIOYYY (IOYYY f) b (I m) x (I n) =- asyncIOCommon $ do+ CInt -> CUInt -> Ptr CString -> Ptr CSize -> Ptr CUInt -> IO ()+asyncIOYYY (IOYYY f) b (I m) x (I n) fd ((/= 0) -> efd) =+ asyncIOCommon+ (do b' <- peekNgxStringArrayLenY b m x' <- B.unsafePackCStringLen (x, n) f b' x'+ ) fd efd bS :: NgxExport -> CString -> CInt -> IO CUInt bS (BS f) x (I n) =
ngx-export.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-version: 0.3.2.2+version: 0.4.0.0 synopsis: Helper module for Nginx haskell module description: Helper module for <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>@@ -21,6 +21,7 @@ , bytestring >= 0.10.0.0 , unix , async >= 2.0+ , binary >= 0.8.1.0 exposed-modules: NgxExport other-modules: Paths_ngx_export