mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-26 11:56:21 +00:00
delays
This commit is contained in:
@@ -924,7 +924,7 @@ pad msg paddedLen
|
||||
|
||||
pad' :: Builder -> Int -> Either CryptoError Builder
|
||||
pad' msg paddedLen
|
||||
| len <= maxMsgLen && padLen >= 0 = Right $ word16BE (fromIntegral len) <> msg <> byteString (B.replicate padLen '#')
|
||||
| len <= maxMsgLen && padLen >= 0 = Right $ byteString (encodeWord16 $ fromIntegral len) <> msg <> byteString (B.replicate padLen '#')
|
||||
| otherwise = Left CryptoLargeMsgError
|
||||
where
|
||||
len = fromIntegral $ LB.length $ toLazyByteString msg
|
||||
|
||||
@@ -22,7 +22,7 @@ where
|
||||
import Data.Attoparsec.ByteString.Char8 (Parser)
|
||||
import qualified Data.Attoparsec.ByteString.Char8 as A
|
||||
import Data.Bits (shiftL, shiftR, (.|.))
|
||||
import Data.ByteString.Builder (Builder, lazyByteString, word16BE)
|
||||
import Data.ByteString.Builder (Builder, byteString, lazyByteString, word16BE)
|
||||
import Data.ByteString.Char8 (ByteString)
|
||||
import qualified Data.ByteString.Char8 as B
|
||||
import qualified Data.ByteString.Lazy.Char8 as LB
|
||||
@@ -142,7 +142,7 @@ instance Encoding Large where
|
||||
{-# INLINE smpP #-}
|
||||
|
||||
encodeLarge :: LB.ByteString -> Builder
|
||||
encodeLarge s = word16BE (fromIntegral $ LB.length s) <> lazyByteString s
|
||||
encodeLarge s = byteString (encodeWord16 $ fromIntegral $ LB.length s) <> lazyByteString s
|
||||
{-# INLINE encodeLarge #-}
|
||||
|
||||
instance Encoding SystemTime where
|
||||
|
||||
@@ -503,13 +503,14 @@ testNotificationsSMPRestartBatch :: Int -> ATransport -> APNSMockServer -> IO ()
|
||||
testNotificationsSMPRestartBatch n t APNSMockServer {apnsQ} = do
|
||||
a <- getSMPAgentClient' agentCfg initAgentServers2 testDB
|
||||
b <- getSMPAgentClient' agentCfg initAgentServers2 testDB2
|
||||
threadDelay 3000000
|
||||
conns <- runServers $ do
|
||||
liftIO $ print 1
|
||||
conns <- replicateM (n :: Int) $ makeConnection a b
|
||||
liftIO $ print 2
|
||||
_ <- registerTestToken a "abcd" NMInstant apnsQ
|
||||
liftIO $ print 3
|
||||
liftIO $ threadDelay 1500000
|
||||
liftIO $ threadDelay 3000000
|
||||
liftIO $ print 4
|
||||
forM_ (zip [0..] conns) $ \(i, (aliceId, bobId)) -> do
|
||||
liftIO $ putStrLn $ "*** msg " <> show i
|
||||
|
||||
Reference in New Issue
Block a user