Hello community,
here is the log from the commit of package ghc-streaming-commons for
openSUSE:Factory checked in at 2016-05-16 12:04:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-streaming-commons (Old)
and /work/SRC/openSUSE:Factory/.ghc-streaming-commons.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-streaming-commons"
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-streaming-commons/ghc-streaming-commons.changes
2016-04-30 23:30:37.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-streaming-commons.new/ghc-streaming-commons.changes
2016-05-16 12:04:09.000000000 +0200
@@ -1,0 +2,6 @@
+Thu May 12 13:44:14 UTC 2016 - [email protected]
+
+- update to 0.1.15.5
+* Make getSocket{Family}TCP try all addr candidates
+
+-------------------------------------------------------------------
Old:
----
streaming-commons-0.1.15.4.tar.gz
New:
----
streaming-commons-0.1.15.5.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-streaming-commons.spec ++++++
--- /var/tmp/diff_new_pack.qRLnPM/_old 2016-05-16 12:04:10.000000000 +0200
+++ /var/tmp/diff_new_pack.qRLnPM/_new 2016-05-16 12:04:10.000000000 +0200
@@ -21,7 +21,7 @@
%bcond_with tests
Name: ghc-streaming-commons
-Version: 0.1.15.4
+Version: 0.1.15.5
Release: 0
Summary: Common lower-level functions needed by various streaming data
libraries
License: MIT
++++++ streaming-commons-0.1.15.4.tar.gz -> streaming-commons-0.1.15.5.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/streaming-commons-0.1.15.4/ChangeLog.md
new/streaming-commons-0.1.15.5/ChangeLog.md
--- old/streaming-commons-0.1.15.4/ChangeLog.md 2016-04-21 19:23:04.000000000
+0200
+++ new/streaming-commons-0.1.15.5/ChangeLog.md 2016-05-11 06:44:05.000000000
+0200
@@ -1,3 +1,7 @@
+## 0.1.15.5
+
+* Make getSocket{Family}TCP try all addr candidates
[#32](https://github.com/fpco/streaming-commons/pull/32)
+
## 0.1.15.3
* Fix benchmarks
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/streaming-commons-0.1.15.4/Data/Streaming/Network.hs
new/streaming-commons-0.1.15.5/Data/Streaming/Network.hs
--- old/streaming-commons-0.1.15.4/Data/Streaming/Network.hs 2015-11-24
11:17:22.000000000 +0100
+++ new/streaming-commons-0.1.15.5/Data/Streaming/Network.hs 2016-05-11
06:44:05.000000000 +0200
@@ -114,17 +114,22 @@
import Control.Concurrent.MVar (putMVar, takeMVar, newEmptyMVar)
#endif
+getPossibleAddrs :: SocketType -> String -> Int -> NS.Family -> IO [AddrInfo]
+getPossibleAddrs sockettype host' port' af =
+ NS.getAddrInfo (Just hints) (Just host') (Just $ show port')
+ where
+ hints = NS.defaultHints {
+ NS.addrFlags = [NS.AI_ADDRCONFIG]
+ , NS.addrSocketType = sockettype
+ , NS.addrFamily = af
+ }
+
-- | Attempt to connect to the given host/port/address family using given
@SocketType@.
--
-- Since 0.1.3
getSocketFamilyGen :: SocketType -> String -> Int -> NS.Family -> IO (Socket,
AddrInfo)
getSocketFamilyGen sockettype host' port' af = do
- let hints = NS.defaultHints {
- NS.addrFlags = [NS.AI_ADDRCONFIG]
- , NS.addrSocketType = sockettype
- , NS.addrFamily = af
- }
- (addr:_) <- NS.getAddrInfo (Just hints) (Just host') (Just $ show port')
+ (addr:_) <- getPossibleAddrs sockettype host' port' af
sock <- NS.socket (NS.addrFamily addr) (NS.addrSocketType addr)
(NS.addrProtocol addr)
return (sock, addr)
@@ -408,15 +413,22 @@
-- Since 0.1.3
getSocketFamilyTCP :: ByteString -> Int -> NS.Family -> IO (NS.Socket,
NS.SockAddr)
getSocketFamilyTCP host' port' addrFamily = do
- (sock, addr) <- getSocketFamilyGen NS.Stream (S8.unpack host') port'
addrFamily
- NS.setSocketOption sock NS.NoDelay 1
- ee <- try' $ NS.connect sock (NS.addrAddress addr)
- case ee of
- Left e -> NS.sClose sock >> throwIO e
- Right () -> return (sock, NS.addrAddress addr)
+ addrsInfo <- getPossibleAddrs NS.Stream (S8.unpack host') port' addrFamily
+ firstSuccess addrsInfo
where
- try' :: IO a -> IO (Either SomeException a)
- try' = try
+ firstSuccess [ai] = connect ai
+ firstSuccess (ai:ais) = connect ai `E.catch` \(_ :: IOException) ->
firstSuccess ais
+ firstSuccess _ = error "getSocketFamilyTCP: can't happen"
+
+ createSocket addrInfo = do
+ sock <- NS.socket (NS.addrFamily addrInfo) (NS.addrSocketType addrInfo)
+ (NS.addrProtocol addrInfo)
+ NS.setSocketOption sock NS.NoDelay 1
+ return sock
+
+ connect addrInfo = E.bracketOnError (createSocket addrInfo) NS.sClose $
\sock -> do
+ NS.connect sock (NS.addrAddress addrInfo)
+ return (sock, NS.addrAddress addrInfo)
-- | Attempt to connect to the given host/port.
getSocketTCP :: ByteString -> Int -> IO (NS.Socket, NS.SockAddr)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/streaming-commons-0.1.15.4/streaming-commons.cabal
new/streaming-commons-0.1.15.5/streaming-commons.cabal
--- old/streaming-commons-0.1.15.4/streaming-commons.cabal 2016-04-24
15:29:18.000000000 +0200
+++ new/streaming-commons-0.1.15.5/streaming-commons.cabal 2016-05-11
06:44:05.000000000 +0200
@@ -1,5 +1,5 @@
name: streaming-commons
-version: 0.1.15.4
+version: 0.1.15.5
synopsis: Common lower-level functions needed by various streaming
data libraries
description: Provides low-dependency functionality commonly needed by
various streaming data libraries, such as conduit and pipes.
homepage: https://github.com/fpco/streaming-commons
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/streaming-commons-0.1.15.4/test/Data/Streaming/NetworkSpec.hs
new/streaming-commons-0.1.15.5/test/Data/Streaming/NetworkSpec.hs
--- old/streaming-commons-0.1.15.4/test/Data/Streaming/NetworkSpec.hs
2015-11-24 11:15:28.000000000 +0100
+++ new/streaming-commons-0.1.15.5/test/Data/Streaming/NetworkSpec.hs
2016-05-11 06:44:05.000000000 +0200
@@ -31,4 +31,4 @@
| null content = "hello"
| otherwise = S8.pack $ take 1000 content
withAsync (runTCPServer (serverSettingsTCPSocket socket)
server) $ \_ -> do
- runTCPClient (clientSettingsTCP port "127.0.0.1") client
+ runTCPClient (clientSettingsTCP port "localhost") client