socket 0.5.2.0 → 0.5.3.0
raw patch · 7 files changed
+57/−1 lines, 7 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +5/−0
- CONTRIBUTORS.txt +1/−0
- platform/linux/include/hs_socket.h +1/−0
- platform/win32/include/hs_socket.h +1/−0
- socket.cabal +11/−1
- src/System/Socket/Internal/Exception.hsc +4/−0
- tests/EOPNOTSUPP.hs +34/−0
CHANGELOG.md view
@@ -1,3 +1,8 @@+0.5.3.0 Lars Petersen <info@lars-petersen.net> 2015-08-09++ * Added a test for `eOperationNotSupported` (try to listen on a UDP socket).+ * Niklas Hambüchen added `eOperationNotSupported`.+ 0.5.2.0 Lars Petersen <info@lars-petersen.net> 2015-07-08 * Don't set `msgNoSignal` automatically with `send` and `sendTo`. This implicit behaviour is a bad design decision. The implications of this change are rather limited. The behaviour/correctness of an application is only affected if it hooked SIGPIPE. GHC's RTS by default ignores SIGPIPE since #1619. You're still advised to adapt your applications to use `msgNoSignal` explicitly when writing on stream oriented sockets. Otherwise the RTS gets unnecessarily interrupted. This is harmless, but annoying and not desired when developing high-performance applications.
CONTRIBUTORS.txt view
@@ -1,3 +1,4 @@+Niklas Hambüchen (issue #9) Michael Fox (reported issue #7) Bryan O'Sullivan (legitimately criticised the bizarre naming) Alex Högy (reported the MSG_NOSIGNAL issue on OSX)
platform/linux/include/hs_socket.h view
@@ -28,6 +28,7 @@ #define SEISCONN EISCONN #define SETIMEDOUT ETIMEDOUT #define SEPIPE EPIPE+#define SEOPNOTSUPP EOPNOTSUPP /* MSG_NOSIGNAL might not be available (i.e. on MacOSX and Solaris). * In this case it gets defined as 0. This is relatively
platform/win32/include/hs_socket.h view
@@ -126,3 +126,4 @@ #define SEISCONN WSAEISCONN #define SETIMEDOUT WSAETIMEDOUT #define SEPIPE WSAECONNABORTED+#define SEOPNOTSUPP WSAEOPNOTSUPP
socket.cabal view
@@ -1,5 +1,5 @@ name: socket-version: 0.5.2.0+version: 0.5.3.0 synopsis: A portable and extensible sockets library. description: This library is a minimal and platform-independant interface for@@ -147,6 +147,16 @@ hs-source-dirs: tests default-language: Haskell2010 main-is: EPIPE.hs+ type: exitcode-stdio-1.0+ build-depends: base >= 4.7 && < 5+ , bytestring < 0.11+ , socket+ , async++test-suite EOPNOTSUPP+ hs-source-dirs: tests+ default-language: Haskell2010+ main-is: EOPNOTSUPP.hs type: exitcode-stdio-1.0 build-depends: base >= 4.7 && < 5 , bytestring < 0.11
src/System/Socket/Internal/Exception.hsc view
@@ -30,6 +30,7 @@ | e == eIsConnected = "eIsConnected" | e == eTimedOut = "eTimedOut" | e == ePipe = "ePipe"+ | e == eOperationNotSupported = "eOperationNotSupported" | otherwise = "SocketException " ++ show i eOk :: SocketException@@ -76,3 +77,6 @@ ePipe :: SocketException ePipe = SocketException (#const SEPIPE)++eOperationNotSupported :: SocketException+eOperationNotSupported = SocketException (#const SEOPNOTSUPP)
+ tests/EOPNOTSUPP.hs view
@@ -0,0 +1,34 @@+{-# LANGUAGE OverloadedStrings #-}+module Main where++import Control.Monad+import Control.Exception+import Control.Concurrent+import Control.Concurrent.Async++import Data.Int+import Data.Monoid+import qualified Data.ByteString.Lazy as LBS++import System.Socket+import System.Socket.Family.Inet as Inet++main :: IO ()+main = do+ bracket+ ( socket `onException` print "E01" :: IO (Socket Inet Datagram UDP)+ )+ (\server-> do+ close server `onException` print "E03"+ )+ (\server-> do+ bind server addr `onException` print "E06"+ e1 <- try (listen server 5)+ case e1 of+ Right _ -> error "E08"+ Left e -> if e == eOperationNotSupported+ then return ()+ else throwIO e `onException` print "E09"+ )+ where+ addr = SocketAddressInet Inet.loopback 7777