Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for network-3.0.0.0. #6

Merged
merged 3 commits into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ install:
- travis_retry cabal update
- cabal install --enable-tests --enable-benchmarks
- cd ./tcp-streams-openssl
- cabal install --only-dependencies --enable-tests --enable-benchmarks
- cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls
- cd ../

# Here starts the actual work to be performed for the package under test; any command which exits with a non-zero exit code causes the build to fail.
Expand Down
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Revision history for tcp-streams

## 1.0.1.1

* Fix [stackage#4312](https://github.com/commercialhaskell/stackage/issues/4312): Relax version bound for `network`.


## 1.0.1.0

* Update test cert(the old one just expired).
Expand Down
12 changes: 10 additions & 2 deletions System/IO/Streams/TCP.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE CPP #-}

-- | This module provides convenience functions for interfacing raw tcp.
--
Expand Down Expand Up @@ -36,6 +37,13 @@ import qualified Network.Socket.ByteString.Lazy as NL
import qualified System.IO.Streams as S
import Foreign.Storable (sizeOf)

addrAny :: N.HostAddress
#if MIN_VERSION_network(2,7,0)
addrAny = N.tupleToHostAddress (0,0,0,0)
#else
addrAny = N.iNADDR_ANY
#endif

-- | Type alias for tcp connection.
--
-- Normally you shouldn't use 'N.Socket' in 'connExtraInfo' directly, this field is
Expand Down Expand Up @@ -145,11 +153,11 @@ bindAndListenWith :: (N.Socket -> IO ()) -- ^ set socket options before binding
-> Int -- ^ connection limit
-> N.PortNumber -- ^ port number
-> IO N.Socket
bindAndListenWith f maxc port = do
bindAndListenWith f maxc port =
E.bracketOnError (N.socket N.AF_INET N.Stream 0)
N.close
(\sock -> do f sock
N.bind sock (N.SockAddrInet port N.iNADDR_ANY)
N.bind sock (N.SockAddrInet port addrAny)
N.listen sock maxc
return sock
)
Expand Down
4 changes: 2 additions & 2 deletions tcp-streams.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: tcp-streams
version: 1.0.1.0
version: 1.0.1.1
synopsis: One stop solution for tcp client and server with tls support.
description: One stop solution for tcp client and server with tls support.
license: BSD3
Expand Down Expand Up @@ -33,7 +33,7 @@ library
other-modules: Paths_tcp_streams
-- other-extensions:
build-depends: base >=4.7 && < 5.0
, network >=2.3 && < 3.0
, network >=2.3 && < 4.0
, bytestring >= 0.10.2.0
, io-streams >= 1.2 && < 2.0
, tls >= 1.3 && < 2.0
Expand Down