keep-alive 0.1.1.0 → 0.2.0.0
raw patch · 6 files changed
+27/−25 lines, 6 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Network.Socket.KeepAlive: OTHER_KEEPALIVE_ERROR :: KeepAliveError
+ Network.Socket.KeepAlive: OTHER_KEEPALIVE_ERROR :: CInt -> KeepAliveError
Files
- ChangeLog.md +8/−0
- cbits/CKa.c +3/−0
- cbits/Cka.c +0/−3
- keep-alive.cabal +4/−10
- src/LibForeign.hsc +3/−3
- src/Network/Socket/KeepAlive.hs +9/−9
ChangeLog.md view
@@ -1,3 +1,11 @@ # Changelog for keep-alive +## 0.1.1.0++- Fix build errors++## 0.2.0.0++- add return code to OTHER_KEEPALIVE_ERROR+ ## Unreleased changes
+ cbits/CKa.c view
@@ -0,0 +1,3 @@+#define INLINE+#include "CKa.h"+
− cbits/Cka.c
@@ -1,3 +0,0 @@-#define INLINE-#include "CKa.h"-
keep-alive.cabal view
@@ -1,13 +1,7 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.------ see: https://github.com/sol/hpack------ hash: e4fadd87f6fc7f6bca702c40ec776acd3dc1b4562423d193979808778831f6b8- name: keep-alive-version: 0.1.1.0+version: 0.2.0.0 homepage: https://github.com/3kyro/keep-alive#readme bug-reports: https://github.com/3kyro/keep-alive/issues author: Kyriakos Papachrysanthou@@ -41,10 +35,10 @@ hs-source-dirs: src build-depends:- base >=4.7 && <5+ base >=4.9 && <5 include-dirs: cbits/- c-sources: cbits/Cka.c+ c-sources: cbits/CKa.c default-language: Haskell2010 test-suite keep-alive-test@@ -54,7 +48,7 @@ Paths_keep_alive hs-source-dirs: test- ghc-options: -threaded -rtsopts -with-rtsopts=-N+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -fwarn-tabs build-depends: base >=4.7 && <5 , keep-alive
src/LibForeign.hsc view
@@ -1,9 +1,9 @@ {-# LANGUAGE CPP, ForeignFunctionInterface #-} module LibForeign where -import Foreign-import Foreign.C.Types-import Foreign.C.Error+import Foreign (Ptr, alloca, peek, sizeOf, with)+import Foreign.C.Types (CInt (..))+import Foreign.C.Error (Errno (..), getErrno) import Data.Word (Word32) -- Platform specific includes
src/Network/Socket/KeepAlive.hs view
@@ -31,10 +31,9 @@ , getKeepAliveOnOff ) where -import Data.Word (Word32)-import Foreign-import Foreign.C-import LibForeign+import Foreign (Word32)+import Foreign.C (CInt)+import LibForeign (getKeepAliveOnOff_, setKeepAlive_) -- | The main data structure defining keep alive parameters@@ -49,7 +48,8 @@ deriving (Show, Eq, Ord) -- | Errors starting with WSA are windows specific-data KeepAliveError = WSA_IO_PENDING+data KeepAliveError+ = WSA_IO_PENDING | WSA_OPERATION_ABORTED | WSAEFAULT | WSAEINPROGRESS@@ -67,7 +67,7 @@ | ENOTSOCK | ENOMEM | ENOBUFS- | OTHER_KEEPALIVE_ERROR+ | OTHER_KEEPALIVE_ERROR CInt deriving (Show, Eq, Ord) -- | Set keep alive parameters for the current socket@@ -99,7 +99,7 @@ 88 -> Left ENOTSOCK 12 -> Left ENOMEM 105 -> Left ENOBUFS- _ -> Left OTHER_KEEPALIVE_ERROR+ other -> Left $ OTHER_KEEPALIVE_ERROR other -- | Returns True if keep alive is active for the specified socket getKeepAliveOnOff ::@@ -107,9 +107,9 @@ -- ^ Socket file descriptor -> IO Bool getKeepAliveOnOff fd =- cToBool . fromInteger . toInteger <$> getKeepAliveOnOff_ fd+ cToBool <$> getKeepAliveOnOff_ fd -cToBool :: Int -> Bool+cToBool :: CInt -> Bool cToBool x | x == 0 = False | otherwise = True