moving API code

This commit is contained in:
2024-11-09 21:28:31 +00:00
parent b6926e0998
commit a9400d9079
2 changed files with 16 additions and 9 deletions

View File

@@ -16,4 +16,5 @@ assignError = MkUnknownError
--
-- TODO: add error when internet connection is off
--
-- Left (MkUnknownError "Unexpected end-of-input, expecting JSON value")
-- MkSystemError 1 "/home/xecarlox/Desktop/p2p-rendering-computation/p2p-rendering-computation" "2024/11/09 21:08:06 Get \"http://0.0.0.0:8088/MAPPort?port=3333&domain_name=\": dial tcp 0.0.0.0:8088: connect: connection refused\n"

View File

@@ -1,15 +1,15 @@
{-# LANGUAGE OverloadedStrings #-}
module P2Prc ( runP2Prc )
where
module P2Prc ( runP2Prc ) where
import System.Process ( ProcessHandle, terminateProcess )
import System.Process
( ProcessHandle
, terminateProcess
)
import Control.Concurrent ( threadDelay )
import Data.Aeson
import Data.Aeson ( FromJSON )
import Environment ( cleanEnvironment )
@@ -23,6 +23,14 @@ import JSON
)
import CLI
( StdInput(..)
, CLIOpt(..)
, eitherErrDecode
, getP2PrcCmd
, eitherExecProcess
, eitherExecProcessParser
, spawnProcP2Prc
)
-- URGENT TASKS
@@ -47,9 +55,6 @@ import CLI
-- TODO: add use case examples (extra-source_files)
-- Module: API
runP2Prc :: IO ()
runP2Prc = do
@@ -135,6 +140,7 @@ runP2Prc = do
(Left err) -> print err
-- Module: API
data P2prAPI = MkP2prAPI
{ startServer :: IOEitherError ProcessHandle