on master help sign in
Silence warning in socketConnection
commitea4fbcd63dfb3741d26430f263d9e65639904237 authorflip111 <flip101@gmail.com> dateWed 5 Feb 2020, 19:58 (7 years ago) parent4b16381
2 files changed+9−5
warp-tls/Network/Wai/Handler/WarpTLS.hs+2−2 warp/Network/Wai/Handler/Warp/Run.hs+7−3
warp-tls/Network/Wai/Handler/WarpTLS.hs+2−2
@@ -483,9 +483,9 @@ tryIO = try
483483----------------------------------------------------------------
484484
485485plainHTTP :: TLSSettings -> Settings -> Socket -> S.ByteString -> IO (Connection, Transport)
486−plainHTTP TLSSettings{..} _ s bs0 = case onInsecure of
486+plainHTTP TLSSettings{..} set s bs0 = case onInsecure of
487487 AllowInsecure -> do
488− conn' <- socketConnection s
488+ conn' <- socketConnection set s
489489 cachedRef <- I.newIORef bs0
490490 let conn'' = conn'
491491 { connRecv = recvPlain cachedRef (connRecv conn')
warp/Network/Wai/Handler/Warp/Run.hs+7−3
@@ -58,8 +58,12 @@ import Network.Socket (fdSocket)
5858#endif
5959
6060-- | Creating 'Connection' for plain HTTP based on a given socket.
61−socketConnection :: Socket -> IO Connection
62−socketConnection s = do
61+socketConnection :: Settings -> Socket -> IO Connection
62+#if MIN_VERSION_network(3,1,1)
63+socketConnection set s = do
64+#else
65+socketConnection _ s = do
66+#endif
6367 bufferPool <- newBufferPool
6468 writeBuf <- allocateBuffer bufferSize
6569 let sendall = Sock.sendAll s
@@ -147,7 +151,7 @@ runSettingsSocket set socket app = do
147151 setSocketCloseOnExec s
148152 -- NoDelay causes an error for AF_UNIX.
149153 setSocketOption s NoDelay 1 `E.catch` \(E.SomeException _) -> return ()
150− conn <- socketConnection s
154+ conn <- socketConnection set s
151155 return (conn, sa)
152156
153157 closeListenSocket = close socket