X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FInteraction.hs;h=1c2679cd9eee65d14c5bf70d0a0b623e3abbe616;hb=cc55fb9a095c9c583ed6fe2ded3eaf6401fb760f;hp=ac9c46f5a93b8e8a78c1bcb583f1d712b0c8a374;hpb=3fe5ca3bca04e0124a5f2440e893dc5375e0bb51;p=Lucu.git diff --git a/Network/HTTP/Lucu/Interaction.hs b/Network/HTTP/Lucu/Interaction.hs index ac9c46f..1c2679c 100644 --- a/Network/HTTP/Lucu/Interaction.hs +++ b/Network/HTTP/Lucu/Interaction.hs @@ -17,12 +17,12 @@ module Network.HTTP.Lucu.Interaction ) where import Blaze.ByteString.Builder (Builder) -import Control.Applicative import Control.Concurrent.STM import Data.Ascii (Ascii) import qualified Data.ByteString as BS import Data.Sequence (Seq) import qualified Data.Sequence as S +import Data.Text (Text) import Network.Socket import Network.HTTP.Lucu.Config import Network.HTTP.Lucu.Headers @@ -36,7 +36,7 @@ data Interaction = Interaction { , itrLocalPort ∷ !PortNumber , itrRemoteAddr ∷ !SockAddr , itrRemoteCert ∷ !(Maybe X509) - , itrResourcePath ∷ !(Maybe [Ascii]) + , itrResourcePath ∷ !(Maybe [Text]) , itrRequest ∷ !(TVar (Maybe Request)) , itrResponse ∷ !(TVar Response) @@ -58,7 +58,7 @@ data Interaction = Interaction { , itrWillClose ∷ !(TVar Bool) , itrBodyToSend ∷ !(TMVar Builder) - , itrBodyIsNull ∷ !(TVar Bool) + , itrSentNoBody ∷ !(TVar Bool) , itrState ∷ !(TVar InteractionState) @@ -110,7 +110,7 @@ newInteraction !conf !port !addr !cert !req willClose ← newTVarIO False bodyToSend ← newEmptyTMVarIO - bodyIsNull ← newTVarIO True -- 一度でも bodyToSend が空でなくなったら False + sentNoBody ← newTVarIO True -- 一度でも bodyToSend が空でなくなったら False state ← newTVarIO ExaminingRequest @@ -144,7 +144,7 @@ newInteraction !conf !port !addr !cert !req , itrWillClose = willClose , itrBodyToSend = bodyToSend - , itrBodyIsNull = bodyIsNull + , itrSentNoBody = sentNoBody , itrState = state @@ -167,13 +167,13 @@ writeItr ∷ (Interaction → TVar a) → a → Interaction → STM () writeItr accessor a itr = writeTVar (accessor itr) a -readItr ∷ (Interaction → TVar a) → (a → b) → Interaction → STM b +readItr ∷ (Interaction → TVar a) → Interaction → STM a {-# INLINE readItr #-} -readItr accessor reader itr - = reader <$> readTVar (accessor itr) +readItr accessor itr + = readTVar (accessor itr) updateItr ∷ (Interaction → TVar a) → (a → a) → Interaction → STM () {-# INLINE updateItr #-} updateItr accessor updator itr - = do old ← readItr accessor id itr + = do old ← readItr accessor itr writeItr accessor (updator old) itr