extend p2p protocol to support gitremote-helpers connect
A bit tricky since Proto doesn't support threads. Rather than adding threading support to it, ended up using a callback that waits for both data on a Handle, and incoming messages at the same time. This commit was sponsored by Denis Dzyubenko on Patreon.
This commit is contained in:
parent
9d9d1fdcd4
commit
0eaad7ca3a
2 changed files with 74 additions and 5 deletions
|
@ -24,6 +24,7 @@ module Utility.SimpleProtocol (
|
|||
|
||||
import Data.Char
|
||||
import GHC.IO.Handle
|
||||
import System.Exit (ExitCode(..))
|
||||
|
||||
import Common
|
||||
|
||||
|
@ -95,3 +96,9 @@ dupIoHandles = do
|
|||
instance Serializable [Char] where
|
||||
serialize = id
|
||||
deserialize = Just
|
||||
|
||||
instance Serializable ExitCode where
|
||||
serialize ExitSuccess = "0"
|
||||
serialize (ExitFailure n) = show n
|
||||
deserialize "0" = Just ExitSuccess
|
||||
deserialize s = ExitFailure <$> readish s
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue