Merge branch 'master' into chat-relays

This commit is contained in:
spaced4ndy
2025-12-19 12:43:12 +04:00
11 changed files with 289 additions and 149 deletions
+7 -3
View File
@@ -233,9 +233,13 @@ startRemoteHost rh_ rcAddrPrefs_ port_ = do
pollEvents :: RemoteHostId -> RemoteHostClient -> CM ()
pollEvents rhId rhClient = do
oq <- asks outputQ
forever $ do
r_ <- liftRH rhId $ remoteRecv rhClient 10000000
forM r_ $ \r -> atomically $ writeTBQueue oq (Just rhId, r)
forever $
handlePollError oq $ do
r_ <- liftRH rhId $ remoteRecv rhClient 10000000
forM_ r_ $ \r -> atomically $ writeTBQueue oq (Just rhId, r)
where
handlePollError oq a = a `catchAllErrors` \e ->
atomically $ writeTBQueue oq (Just rhId, Left e)
httpError :: RemoteHostId -> HTTP2ClientError -> ChatError
httpError rhId = ChatErrorRemoteHost (RHId rhId) . RHEProtocolError . RPEHTTP2 . tshow
+2 -1
View File
@@ -36,6 +36,7 @@ import qualified Data.Aeson.TH as JQ
import qualified Data.Attoparsec.ByteString.Char8 as A
import qualified Data.ByteString.Base64 as B64
import Data.ByteString.Char8 (ByteString, pack, unpack)
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.Lazy as LB
import Data.Functor (($>))
import Data.Int (Int64)
@@ -1416,7 +1417,7 @@ instance ToField AgentConnId where toField (AgentConnId m) = toField $ Binary m
instance StrEncoding AgentConnId where
strEncode (AgentConnId connId) = strEncode connId
strDecode s = AgentConnId <$> strDecode s
strP = AgentConnId <$> strP
strP = AgentConnId <$> (strP <|> pure B.empty)
instance FromJSON AgentConnId where
parseJSON = strParseJSON "AgentConnId"