From e2d8d422a6f03ad94221f6540846e61adf731b0c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 28 Aug 2016 21:09:28 -0400 Subject: refactor --- HTTP/Server.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'HTTP') diff --git a/HTTP/Server.hs b/HTTP/Server.hs index 816cf47..f599c31 100644 --- a/HTTP/Server.hs +++ b/HTTP/Server.hs @@ -19,6 +19,7 @@ import Network.Wai.Handler.Warp import Control.Monad.IO.Class import Control.Concurrent import Control.Concurrent.STM +import qualified Data.ByteString as B data ServerState = ServerState { obscurerRequest :: TMVar () @@ -69,6 +70,11 @@ putObject st i _pow o = do return $ Result r else return $ Result $ StoreFailure "invalid object size" +validObjectsize :: StorableObject -> Bool +validObjectsize o = any (sz ==) knownObjectSizes + where + sz = B.length (fromStorableObject o) + countObjects :: ServerState -> Maybe ProofOfWork -> Handler (ProofOfWorkRequirement CountResult) countObjects _st _pow = liftIO $ Result <$> countShares serverStorage -- cgit v1.2.3