diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-28 21:09:28 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-28 21:09:28 -0400 |
commit | e2d8d422a6f03ad94221f6540846e61adf731b0c (patch) | |
tree | 97b8280ba30625c71b5d93a2204f26893cb727f2 /HTTP | |
parent | 945fb3387b56be0da576d06155f35372b35095bc (diff) | |
download | keysafe-e2d8d422a6f03ad94221f6540846e61adf731b0c.tar.gz |
refactor
Diffstat (limited to 'HTTP')
-rw-r--r-- | HTTP/Server.hs | 6 |
1 files changed, 6 insertions, 0 deletions
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 |