diff options
Diffstat (limited to 'HTTP/Server.hs')
-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 |