Skip to content
Snippets Groups Projects
Commit fa780fab authored by Jens Nolte's avatar Jens Nolte
Browse files

Make byte counters strict

parent 3fe70fb4
No related branches found
No related tags found
No related merge requests found
...@@ -289,8 +289,8 @@ type ServerProtocolState m = ProtocolState 'Server m ...@@ -289,8 +289,8 @@ type ServerProtocolState m = ProtocolState 'Server m
data ProtocolState (s :: Side) m = ProtocolState { data ProtocolState (s :: Side) m = ProtocolState {
protocolException :: Maybe SomeException, protocolException :: Maybe SomeException,
bytesReceived :: Word64, bytesReceived :: !Word64,
bytesSent :: Word64, bytesSent :: !Word64,
inboxDecoder :: Decoder RawMessage, inboxDecoder :: Decoder RawMessage,
outbox :: Maybe Put, outbox :: Maybe Put,
objects :: HashMap ObjectId (SomeObject s m) objects :: HashMap ObjectId (SomeObject s m)
...@@ -385,9 +385,10 @@ setException ex = protocolStep do ...@@ -385,9 +385,10 @@ setException ex = protocolStep do
-- | Take data that has to be sent (if available) -- | Take data that has to be sent (if available)
takeOutbox :: MonadCatch m => ProtocolState s m -> (Maybe BSL.ByteString, ProtocolState s m) takeOutbox :: MonadCatch m => ProtocolState s m -> (Maybe BSL.ByteString, ProtocolState s m)
takeOutbox st = (outboxBytes, st{outbox = Nothing}) takeOutbox st = (maybeOutboxBytes, st{outbox = Nothing})
where where
outboxBytes = if isJust st.protocolException then Nothing else runPut <$> st.outbox maybeOutboxBytes = if isJust st.protocolException then Nothing else outboxBytes
outboxBytes = runPut <$> st.outbox
sendInitialMessage :: ProtocolState s m -> ProtocolState s m sendInitialMessage :: ProtocolState s m -> ProtocolState s m
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment