on master help sign in
Removing PESSIMISTIC_RECV.

PESSIMISTIC_RECV would cause dead-lock if parallel IO manager comes since it uses ET(Edge Triggered).

commit955acfc231326ee26dcb6aeea7ada68b2864711b authorKazu Yamamoto <kazu@iij.ad.jp> dateWed 5 Dec 2012, 17:53 (14 years ago) parentcd8abaa
1 file changed−17
warp/Network/Wai/Handler/Warp/Run.hs−17
warp/Network/Wai/Handler/Warp/Run.hs−17
@@ -29,15 +29,6 @@ import Prelude hiding (catch)
2929-- Sock.recv first tries to call recvfrom() optimistically.
3030-- If EAGAIN returns, it polls incoming data with epoll/kqueue.
3131-- This code first polls incoming data with epoll/kqueue.
32−#if !WINDOWS
33−#define PESSIMISTIC_RECV 1
34−#endif
35−
36−#ifdef PESSIMISTIC_RECV
37−import System.Posix.Types (Fd(..))
38−import Control.Concurrent (threadWaitRead)
39−import Network.Socket (Socket(..))
40−#endif
4132
4233#if WINDOWS
4334import qualified Control.Concurrent.MVar as MV
@@ -55,20 +46,12 @@ bytesPerRead = 4096
5546
5647-- | Default action value for 'Connection'
5748socketConnection :: Socket -> Connection
58−#ifdef PESSIMISTIC_RECV
59−socketConnection s@(MkSocket fd _ _ _ _) = Connection
60−#else
6149socketConnection s = Connection
62−#endif
6350 { connSendMany = Sock.sendMany s
6451 , connSendAll = Sock.sendAll s
6552 , connSendFile = sendFile s
6653 , connClose = sClose s
67−#ifdef PESSIMISTIC_RECV
68− , connRecv = threadWaitRead (Fd fd) >> Sock.recv s bytesPerRead
69−#else
7054 , connRecv = Sock.recv s bytesPerRead
71−#endif
7255 }
7356
7457sendFile :: Socket -> FilePath -> Integer -> Integer -> IO () -> [ByteString] -> Cleaner -> IO ()