on master help sign in
doc update.
commit281340d7ba7aeab602f0b1ba0efa898e4fe691fb authorKazu Yamamoto <kazu@iij.ad.jp> dateMon 29 Jun 2015, 14:30 (11 years ago) parentcb4cd35
3 files changed+12−1
warp/Network/Wai/Handler/Warp/Buffer.hs+3−1 warp/Network/Wai/Handler/Warp/Recv.hs+5 warp/Network/Wai/Handler/Warp/Types.hs+4
warp/Network/Wai/Handler/Warp/Buffer.hs+3−1
@@ -102,11 +102,13 @@ toBlazeBuffer ptr size = do
102102 fptr <- newForeignPtr_ ptr
103103 return $ B.Buffer fptr ptr ptr (ptr `plusPtr` size)
104104
105−{-# INLINE copy #-}
105+-- | Copying the bytestring to the buffer.
106+-- This function returns the point where the next copy should start.
106107copy :: Buffer -> ByteString -> IO Buffer
107108copy !ptr (PS fp o l) = withForeignPtr fp $ \p -> do
108109 memcpy ptr (p `plusPtr` o) (fromIntegral l)
109110 return $! ptr `plusPtr` l
111+{-# INLINE copy #-}
110112
111113{-# INLINE toBS #-}
112114toBS :: Buffer -> Int -> IO ByteString
warp/Network/Wai/Handler/Warp/Recv.hs+5
@@ -38,6 +38,11 @@ makeReceiveN bs0 recv recvBuf = do
3838 ref <- newIORef bs0
3939 return $ receiveN ref recv recvBuf
4040
41+-- | This function returns a receiving function
42+-- based on two receiving functions.
43+-- The returned function efficiently manages received data
44+-- which is initialized by the first argument.
45+-- The returned function may allocate a byte string with malloc().
4146makePlainReceiveN :: Socket -> ByteString -> IO (BufSize -> IO ByteString)
4247makePlainReceiveN s bs0 = do
4348 ref <- newIORef bs0
warp/Network/Wai/Handler/Warp/Types.hs+4
@@ -95,7 +95,11 @@ type Buffer = Ptr Word8
9595-- | Type for buffer size
9696type BufSize = Int
9797
98+-- | Type for the action to receive input data
9899type Recv = IO ByteString
100+
101+-- | Type for the action to receive input data with a buffer.
102+-- The result boolean indicates whether or not the buffer is fully filled.
99103type RecvBuf = Buffer -> BufSize -> IO Bool
100104
101105-- | Data type to manipulate IO actions for connections.