mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-22 12:19:55 +00:00
Merge branch 'master' into chat-relays
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user