{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} module Network.QUIC.Connection.Stream ( getMyStreamId , waitMyNewStreamId , waitMyNewUniStreamId , setMyMaxStreams , setMyUniMaxStreams , getPeerMaxStreams , setPeerMaxStreams ) where import UnliftIO.STM import Network.QUIC.Connection.Types import Network.QUIC.Imports import Network.QUIC.Types getMyStreamId :: Connection -> IO Int getMyStreamId :: Connection -> IO Int getMyStreamId Connection{Recv Buffer Array EncryptionLevel (TVar [ReceivedPacket]) IOArray Bool Coder1RTT IOArray EncryptionLevel Cipher IOArray EncryptionLevel Protector IOArray EncryptionLevel Coder ThreadId TVar Bool TVar Int TVar Flow TVar Concurrency TVar MigrationState TVar CIDDB IORef Int IORef (IO ()) IORef (Bool, Int) IORef UDPSocket IORef Microseconds IORef VersionInfo IORef Flow IORef StreamTable IORef AuthCIDs IORef Parameters IORef Concurrency IORef Negotiated IORef CIDDB IORef RoleInfo MigrationQ OutputQ CryptoQ InputQ VersionInfo RecvQ SizedBuffer ConnState Parameters LDCC Hooks Shared Send DebugLogger QLogger connLDCC :: Connection -> LDCC decryptBuf :: Connection -> Buffer encryptRes :: Connection -> SizedBuffer encodeBuf :: Connection -> Buffer connResources :: Connection -> IORef (IO ()) connPeerAuthCIDs :: Connection -> IORef AuthCIDs connMyAuthCIDs :: Connection -> IORef AuthCIDs negotiated :: Connection -> IORef Negotiated currentKeyPhase :: Connection -> IORef (Bool, Int) protectors :: Connection -> IOArray EncryptionLevel Protector coders1RTT :: Connection -> IOArray Bool Coder1RTT coders :: Connection -> IOArray EncryptionLevel Coder ciphers :: Connection -> IOArray EncryptionLevel Cipher pendingQ :: Connection -> Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: Connection -> TVar Bool bytesRx :: Connection -> TVar Int bytesTx :: Connection -> TVar Int minIdleTimeout :: Connection -> IORef Microseconds migrationState :: Connection -> TVar MigrationState flowRx :: Connection -> IORef Flow flowTx :: Connection -> TVar Flow peerStreamId :: Connection -> IORef Concurrency myUniStreamId :: Connection -> TVar Concurrency myStreamId :: Connection -> TVar Concurrency streamTable :: Connection -> IORef StreamTable peerPacketNumber :: Connection -> IORef Int delayedAckCancel :: Connection -> IORef (IO ()) delayedAckCount :: Connection -> IORef Int shared :: Connection -> Shared migrationQ :: Connection -> MigrationQ outputQ :: Connection -> OutputQ cryptoQ :: Connection -> CryptoQ inputQ :: Connection -> InputQ peerCIDDB :: Connection -> TVar CIDDB peerParameters :: Connection -> IORef Parameters myCIDDB :: Connection -> IORef CIDDB myParameters :: Connection -> Parameters origVersionInfo :: Connection -> VersionInfo quicVersionInfo :: Connection -> IORef VersionInfo roleInfo :: Connection -> IORef RoleInfo mainThreadId :: Connection -> ThreadId tmouter :: Connection -> IORef (IO ()) readers :: Connection -> IORef (IO ()) udpSocket :: Connection -> IORef UDPSocket connRecvQ :: Connection -> RecvQ connRecv :: Connection -> Recv connSend :: Connection -> Send connHooks :: Connection -> Hooks connQLog :: Connection -> QLogger connDebugLog :: Connection -> DebugLogger connState :: Connection -> ConnState connLDCC :: LDCC decryptBuf :: Buffer encryptRes :: SizedBuffer encodeBuf :: Buffer connResources :: IORef (IO ()) connPeerAuthCIDs :: IORef AuthCIDs connMyAuthCIDs :: IORef AuthCIDs negotiated :: IORef Negotiated currentKeyPhase :: IORef (Bool, Int) protectors :: IOArray EncryptionLevel Protector coders1RTT :: IOArray Bool Coder1RTT coders :: IOArray EncryptionLevel Coder ciphers :: IOArray EncryptionLevel Cipher pendingQ :: Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: TVar Bool bytesRx :: TVar Int bytesTx :: TVar Int minIdleTimeout :: IORef Microseconds migrationState :: TVar MigrationState flowRx :: IORef Flow flowTx :: TVar Flow peerStreamId :: IORef Concurrency myUniStreamId :: TVar Concurrency myStreamId :: TVar Concurrency streamTable :: IORef StreamTable peerPacketNumber :: IORef Int delayedAckCancel :: IORef (IO ()) delayedAckCount :: IORef Int shared :: Shared migrationQ :: MigrationQ outputQ :: OutputQ cryptoQ :: CryptoQ inputQ :: InputQ peerCIDDB :: TVar CIDDB peerParameters :: IORef Parameters myCIDDB :: IORef CIDDB myParameters :: Parameters origVersionInfo :: VersionInfo quicVersionInfo :: IORef VersionInfo roleInfo :: IORef RoleInfo mainThreadId :: ThreadId tmouter :: IORef (IO ()) readers :: IORef (IO ()) udpSocket :: IORef UDPSocket connRecvQ :: RecvQ connRecv :: Recv connSend :: Send connHooks :: Hooks connQLog :: QLogger connDebugLog :: DebugLogger connState :: ConnState ..} = do Int next <- Concurrency -> Int currentStream forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *) a. MonadIO m => TVar a -> m a readTVarIO TVar Concurrency myStreamId forall (m :: * -> *) a. Monad m => a -> m a return forall a b. (a -> b) -> a -> b $ Int next forall a. Num a => a -> a -> a - Int 4 waitMyNewStreamId :: Connection -> IO StreamId waitMyNewStreamId :: Connection -> IO Int waitMyNewStreamId Connection{Recv Buffer Array EncryptionLevel (TVar [ReceivedPacket]) IOArray Bool Coder1RTT IOArray EncryptionLevel Cipher IOArray EncryptionLevel Protector IOArray EncryptionLevel Coder ThreadId TVar Bool TVar Int TVar Flow TVar Concurrency TVar MigrationState TVar CIDDB IORef Int IORef (IO ()) IORef (Bool, Int) IORef UDPSocket IORef Microseconds IORef VersionInfo IORef Flow IORef StreamTable IORef AuthCIDs IORef Parameters IORef Concurrency IORef Negotiated IORef CIDDB IORef RoleInfo MigrationQ OutputQ CryptoQ InputQ VersionInfo RecvQ SizedBuffer ConnState Parameters LDCC Hooks Shared Send DebugLogger QLogger connLDCC :: LDCC decryptBuf :: Buffer encryptRes :: SizedBuffer encodeBuf :: Buffer connResources :: IORef (IO ()) connPeerAuthCIDs :: IORef AuthCIDs connMyAuthCIDs :: IORef AuthCIDs negotiated :: IORef Negotiated currentKeyPhase :: IORef (Bool, Int) protectors :: IOArray EncryptionLevel Protector coders1RTT :: IOArray Bool Coder1RTT coders :: IOArray EncryptionLevel Coder ciphers :: IOArray EncryptionLevel Cipher pendingQ :: Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: TVar Bool bytesRx :: TVar Int bytesTx :: TVar Int minIdleTimeout :: IORef Microseconds migrationState :: TVar MigrationState flowRx :: IORef Flow flowTx :: TVar Flow peerStreamId :: IORef Concurrency myUniStreamId :: TVar Concurrency myStreamId :: TVar Concurrency streamTable :: IORef StreamTable peerPacketNumber :: IORef Int delayedAckCancel :: IORef (IO ()) delayedAckCount :: IORef Int shared :: Shared migrationQ :: MigrationQ outputQ :: OutputQ cryptoQ :: CryptoQ inputQ :: InputQ peerCIDDB :: TVar CIDDB peerParameters :: IORef Parameters myCIDDB :: IORef CIDDB myParameters :: Parameters origVersionInfo :: VersionInfo quicVersionInfo :: IORef VersionInfo roleInfo :: IORef RoleInfo mainThreadId :: ThreadId tmouter :: IORef (IO ()) readers :: IORef (IO ()) udpSocket :: IORef UDPSocket connRecvQ :: RecvQ connRecv :: Recv connSend :: Send connHooks :: Hooks connQLog :: QLogger connDebugLog :: DebugLogger connState :: ConnState connLDCC :: Connection -> LDCC decryptBuf :: Connection -> Buffer encryptRes :: Connection -> SizedBuffer encodeBuf :: Connection -> Buffer connResources :: Connection -> IORef (IO ()) connPeerAuthCIDs :: Connection -> IORef AuthCIDs connMyAuthCIDs :: Connection -> IORef AuthCIDs negotiated :: Connection -> IORef Negotiated currentKeyPhase :: Connection -> IORef (Bool, Int) protectors :: Connection -> IOArray EncryptionLevel Protector coders1RTT :: Connection -> IOArray Bool Coder1RTT coders :: Connection -> IOArray EncryptionLevel Coder ciphers :: Connection -> IOArray EncryptionLevel Cipher pendingQ :: Connection -> Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: Connection -> TVar Bool bytesRx :: Connection -> TVar Int bytesTx :: Connection -> TVar Int minIdleTimeout :: Connection -> IORef Microseconds migrationState :: Connection -> TVar MigrationState flowRx :: Connection -> IORef Flow flowTx :: Connection -> TVar Flow peerStreamId :: Connection -> IORef Concurrency myUniStreamId :: Connection -> TVar Concurrency myStreamId :: Connection -> TVar Concurrency streamTable :: Connection -> IORef StreamTable peerPacketNumber :: Connection -> IORef Int delayedAckCancel :: Connection -> IORef (IO ()) delayedAckCount :: Connection -> IORef Int shared :: Connection -> Shared migrationQ :: Connection -> MigrationQ outputQ :: Connection -> OutputQ cryptoQ :: Connection -> CryptoQ inputQ :: Connection -> InputQ peerCIDDB :: Connection -> TVar CIDDB peerParameters :: Connection -> IORef Parameters myCIDDB :: Connection -> IORef CIDDB myParameters :: Connection -> Parameters origVersionInfo :: Connection -> VersionInfo quicVersionInfo :: Connection -> IORef VersionInfo roleInfo :: Connection -> IORef RoleInfo mainThreadId :: Connection -> ThreadId tmouter :: Connection -> IORef (IO ()) readers :: Connection -> IORef (IO ()) udpSocket :: Connection -> IORef UDPSocket connRecvQ :: Connection -> RecvQ connRecv :: Connection -> Recv connSend :: Connection -> Send connHooks :: Connection -> Hooks connQLog :: Connection -> QLogger connDebugLog :: Connection -> DebugLogger connState :: Connection -> ConnState ..} = TVar Concurrency -> IO Int get TVar Concurrency myStreamId waitMyNewUniStreamId :: Connection -> IO StreamId waitMyNewUniStreamId :: Connection -> IO Int waitMyNewUniStreamId Connection{Recv Buffer Array EncryptionLevel (TVar [ReceivedPacket]) IOArray Bool Coder1RTT IOArray EncryptionLevel Cipher IOArray EncryptionLevel Protector IOArray EncryptionLevel Coder ThreadId TVar Bool TVar Int TVar Flow TVar Concurrency TVar MigrationState TVar CIDDB IORef Int IORef (IO ()) IORef (Bool, Int) IORef UDPSocket IORef Microseconds IORef VersionInfo IORef Flow IORef StreamTable IORef AuthCIDs IORef Parameters IORef Concurrency IORef Negotiated IORef CIDDB IORef RoleInfo MigrationQ OutputQ CryptoQ InputQ VersionInfo RecvQ SizedBuffer ConnState Parameters LDCC Hooks Shared Send DebugLogger QLogger connLDCC :: LDCC decryptBuf :: Buffer encryptRes :: SizedBuffer encodeBuf :: Buffer connResources :: IORef (IO ()) connPeerAuthCIDs :: IORef AuthCIDs connMyAuthCIDs :: IORef AuthCIDs negotiated :: IORef Negotiated currentKeyPhase :: IORef (Bool, Int) protectors :: IOArray EncryptionLevel Protector coders1RTT :: IOArray Bool Coder1RTT coders :: IOArray EncryptionLevel Coder ciphers :: IOArray EncryptionLevel Cipher pendingQ :: Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: TVar Bool bytesRx :: TVar Int bytesTx :: TVar Int minIdleTimeout :: IORef Microseconds migrationState :: TVar MigrationState flowRx :: IORef Flow flowTx :: TVar Flow peerStreamId :: IORef Concurrency myUniStreamId :: TVar Concurrency myStreamId :: TVar Concurrency streamTable :: IORef StreamTable peerPacketNumber :: IORef Int delayedAckCancel :: IORef (IO ()) delayedAckCount :: IORef Int shared :: Shared migrationQ :: MigrationQ outputQ :: OutputQ cryptoQ :: CryptoQ inputQ :: InputQ peerCIDDB :: TVar CIDDB peerParameters :: IORef Parameters myCIDDB :: IORef CIDDB myParameters :: Parameters origVersionInfo :: VersionInfo quicVersionInfo :: IORef VersionInfo roleInfo :: IORef RoleInfo mainThreadId :: ThreadId tmouter :: IORef (IO ()) readers :: IORef (IO ()) udpSocket :: IORef UDPSocket connRecvQ :: RecvQ connRecv :: Recv connSend :: Send connHooks :: Hooks connQLog :: QLogger connDebugLog :: DebugLogger connState :: ConnState connLDCC :: Connection -> LDCC decryptBuf :: Connection -> Buffer encryptRes :: Connection -> SizedBuffer encodeBuf :: Connection -> Buffer connResources :: Connection -> IORef (IO ()) connPeerAuthCIDs :: Connection -> IORef AuthCIDs connMyAuthCIDs :: Connection -> IORef AuthCIDs negotiated :: Connection -> IORef Negotiated currentKeyPhase :: Connection -> IORef (Bool, Int) protectors :: Connection -> IOArray EncryptionLevel Protector coders1RTT :: Connection -> IOArray Bool Coder1RTT coders :: Connection -> IOArray EncryptionLevel Coder ciphers :: Connection -> IOArray EncryptionLevel Cipher pendingQ :: Connection -> Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: Connection -> TVar Bool bytesRx :: Connection -> TVar Int bytesTx :: Connection -> TVar Int minIdleTimeout :: Connection -> IORef Microseconds migrationState :: Connection -> TVar MigrationState flowRx :: Connection -> IORef Flow flowTx :: Connection -> TVar Flow peerStreamId :: Connection -> IORef Concurrency myUniStreamId :: Connection -> TVar Concurrency myStreamId :: Connection -> TVar Concurrency streamTable :: Connection -> IORef StreamTable peerPacketNumber :: Connection -> IORef Int delayedAckCancel :: Connection -> IORef (IO ()) delayedAckCount :: Connection -> IORef Int shared :: Connection -> Shared migrationQ :: Connection -> MigrationQ outputQ :: Connection -> OutputQ cryptoQ :: Connection -> CryptoQ inputQ :: Connection -> InputQ peerCIDDB :: Connection -> TVar CIDDB peerParameters :: Connection -> IORef Parameters myCIDDB :: Connection -> IORef CIDDB myParameters :: Connection -> Parameters origVersionInfo :: Connection -> VersionInfo quicVersionInfo :: Connection -> IORef VersionInfo roleInfo :: Connection -> IORef RoleInfo mainThreadId :: Connection -> ThreadId tmouter :: Connection -> IORef (IO ()) readers :: Connection -> IORef (IO ()) udpSocket :: Connection -> IORef UDPSocket connRecvQ :: Connection -> RecvQ connRecv :: Connection -> Recv connSend :: Connection -> Send connHooks :: Connection -> Hooks connQLog :: Connection -> QLogger connDebugLog :: Connection -> DebugLogger connState :: Connection -> ConnState ..} = TVar Concurrency -> IO Int get TVar Concurrency myUniStreamId get :: TVar Concurrency -> IO Int get :: TVar Concurrency -> IO Int get TVar Concurrency tvar = forall (m :: * -> *) a. MonadIO m => STM a -> m a atomically forall a b. (a -> b) -> a -> b $ do conc :: Concurrency conc@Concurrency{Int maxStreams :: Concurrency -> Int streamType :: Concurrency -> Int maxStreams :: Int streamType :: Int currentStream :: Int currentStream :: Concurrency -> Int ..} <- forall a. TVar a -> STM a readTVar TVar Concurrency tvar Bool -> STM () checkSTM (Int currentStream forall a. Ord a => a -> a -> Bool < Int maxStreams forall a. Num a => a -> a -> a * Int 4 forall a. Num a => a -> a -> a + Int streamType) let currentStream' :: Int currentStream' = Int currentStream forall a. Num a => a -> a -> a + Int 4 forall a. TVar a -> a -> STM () writeTVar TVar Concurrency tvar Concurrency conc { currentStream :: Int currentStream = Int currentStream' } forall (m :: * -> *) a. Monad m => a -> m a return Int currentStream setMyMaxStreams :: Connection -> Int -> IO () setMyMaxStreams :: Connection -> Int -> IO () setMyMaxStreams Connection{Recv Buffer Array EncryptionLevel (TVar [ReceivedPacket]) IOArray Bool Coder1RTT IOArray EncryptionLevel Cipher IOArray EncryptionLevel Protector IOArray EncryptionLevel Coder ThreadId TVar Bool TVar Int TVar Flow TVar Concurrency TVar MigrationState TVar CIDDB IORef Int IORef (IO ()) IORef (Bool, Int) IORef UDPSocket IORef Microseconds IORef VersionInfo IORef Flow IORef StreamTable IORef AuthCIDs IORef Parameters IORef Concurrency IORef Negotiated IORef CIDDB IORef RoleInfo MigrationQ OutputQ CryptoQ InputQ VersionInfo RecvQ SizedBuffer ConnState Parameters LDCC Hooks Shared Send DebugLogger QLogger connLDCC :: LDCC decryptBuf :: Buffer encryptRes :: SizedBuffer encodeBuf :: Buffer connResources :: IORef (IO ()) connPeerAuthCIDs :: IORef AuthCIDs connMyAuthCIDs :: IORef AuthCIDs negotiated :: IORef Negotiated currentKeyPhase :: IORef (Bool, Int) protectors :: IOArray EncryptionLevel Protector coders1RTT :: IOArray Bool Coder1RTT coders :: IOArray EncryptionLevel Coder ciphers :: IOArray EncryptionLevel Cipher pendingQ :: Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: TVar Bool bytesRx :: TVar Int bytesTx :: TVar Int minIdleTimeout :: IORef Microseconds migrationState :: TVar MigrationState flowRx :: IORef Flow flowTx :: TVar Flow peerStreamId :: IORef Concurrency myUniStreamId :: TVar Concurrency myStreamId :: TVar Concurrency streamTable :: IORef StreamTable peerPacketNumber :: IORef Int delayedAckCancel :: IORef (IO ()) delayedAckCount :: IORef Int shared :: Shared migrationQ :: MigrationQ outputQ :: OutputQ cryptoQ :: CryptoQ inputQ :: InputQ peerCIDDB :: TVar CIDDB peerParameters :: IORef Parameters myCIDDB :: IORef CIDDB myParameters :: Parameters origVersionInfo :: VersionInfo quicVersionInfo :: IORef VersionInfo roleInfo :: IORef RoleInfo mainThreadId :: ThreadId tmouter :: IORef (IO ()) readers :: IORef (IO ()) udpSocket :: IORef UDPSocket connRecvQ :: RecvQ connRecv :: Recv connSend :: Send connHooks :: Hooks connQLog :: QLogger connDebugLog :: DebugLogger connState :: ConnState connLDCC :: Connection -> LDCC decryptBuf :: Connection -> Buffer encryptRes :: Connection -> SizedBuffer encodeBuf :: Connection -> Buffer connResources :: Connection -> IORef (IO ()) connPeerAuthCIDs :: Connection -> IORef AuthCIDs connMyAuthCIDs :: Connection -> IORef AuthCIDs negotiated :: Connection -> IORef Negotiated currentKeyPhase :: Connection -> IORef (Bool, Int) protectors :: Connection -> IOArray EncryptionLevel Protector coders1RTT :: Connection -> IOArray Bool Coder1RTT coders :: Connection -> IOArray EncryptionLevel Coder ciphers :: Connection -> IOArray EncryptionLevel Cipher pendingQ :: Connection -> Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: Connection -> TVar Bool bytesRx :: Connection -> TVar Int bytesTx :: Connection -> TVar Int minIdleTimeout :: Connection -> IORef Microseconds migrationState :: Connection -> TVar MigrationState flowRx :: Connection -> IORef Flow flowTx :: Connection -> TVar Flow peerStreamId :: Connection -> IORef Concurrency myUniStreamId :: Connection -> TVar Concurrency myStreamId :: Connection -> TVar Concurrency streamTable :: Connection -> IORef StreamTable peerPacketNumber :: Connection -> IORef Int delayedAckCancel :: Connection -> IORef (IO ()) delayedAckCount :: Connection -> IORef Int shared :: Connection -> Shared migrationQ :: Connection -> MigrationQ outputQ :: Connection -> OutputQ cryptoQ :: Connection -> CryptoQ inputQ :: Connection -> InputQ peerCIDDB :: Connection -> TVar CIDDB peerParameters :: Connection -> IORef Parameters myCIDDB :: Connection -> IORef CIDDB myParameters :: Connection -> Parameters origVersionInfo :: Connection -> VersionInfo quicVersionInfo :: Connection -> IORef VersionInfo roleInfo :: Connection -> IORef RoleInfo mainThreadId :: Connection -> ThreadId tmouter :: Connection -> IORef (IO ()) readers :: Connection -> IORef (IO ()) udpSocket :: Connection -> IORef UDPSocket connRecvQ :: Connection -> RecvQ connRecv :: Connection -> Recv connSend :: Connection -> Send connHooks :: Connection -> Hooks connQLog :: Connection -> QLogger connDebugLog :: Connection -> DebugLogger connState :: Connection -> ConnState ..} = TVar Concurrency -> Int -> IO () set TVar Concurrency myStreamId setMyUniMaxStreams :: Connection -> Int -> IO () setMyUniMaxStreams :: Connection -> Int -> IO () setMyUniMaxStreams Connection{Recv Buffer Array EncryptionLevel (TVar [ReceivedPacket]) IOArray Bool Coder1RTT IOArray EncryptionLevel Cipher IOArray EncryptionLevel Protector IOArray EncryptionLevel Coder ThreadId TVar Bool TVar Int TVar Flow TVar Concurrency TVar MigrationState TVar CIDDB IORef Int IORef (IO ()) IORef (Bool, Int) IORef UDPSocket IORef Microseconds IORef VersionInfo IORef Flow IORef StreamTable IORef AuthCIDs IORef Parameters IORef Concurrency IORef Negotiated IORef CIDDB IORef RoleInfo MigrationQ OutputQ CryptoQ InputQ VersionInfo RecvQ SizedBuffer ConnState Parameters LDCC Hooks Shared Send DebugLogger QLogger connLDCC :: LDCC decryptBuf :: Buffer encryptRes :: SizedBuffer encodeBuf :: Buffer connResources :: IORef (IO ()) connPeerAuthCIDs :: IORef AuthCIDs connMyAuthCIDs :: IORef AuthCIDs negotiated :: IORef Negotiated currentKeyPhase :: IORef (Bool, Int) protectors :: IOArray EncryptionLevel Protector coders1RTT :: IOArray Bool Coder1RTT coders :: IOArray EncryptionLevel Coder ciphers :: IOArray EncryptionLevel Cipher pendingQ :: Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: TVar Bool bytesRx :: TVar Int bytesTx :: TVar Int minIdleTimeout :: IORef Microseconds migrationState :: TVar MigrationState flowRx :: IORef Flow flowTx :: TVar Flow peerStreamId :: IORef Concurrency myUniStreamId :: TVar Concurrency myStreamId :: TVar Concurrency streamTable :: IORef StreamTable peerPacketNumber :: IORef Int delayedAckCancel :: IORef (IO ()) delayedAckCount :: IORef Int shared :: Shared migrationQ :: MigrationQ outputQ :: OutputQ cryptoQ :: CryptoQ inputQ :: InputQ peerCIDDB :: TVar CIDDB peerParameters :: IORef Parameters myCIDDB :: IORef CIDDB myParameters :: Parameters origVersionInfo :: VersionInfo quicVersionInfo :: IORef VersionInfo roleInfo :: IORef RoleInfo mainThreadId :: ThreadId tmouter :: IORef (IO ()) readers :: IORef (IO ()) udpSocket :: IORef UDPSocket connRecvQ :: RecvQ connRecv :: Recv connSend :: Send connHooks :: Hooks connQLog :: QLogger connDebugLog :: DebugLogger connState :: ConnState connLDCC :: Connection -> LDCC decryptBuf :: Connection -> Buffer encryptRes :: Connection -> SizedBuffer encodeBuf :: Connection -> Buffer connResources :: Connection -> IORef (IO ()) connPeerAuthCIDs :: Connection -> IORef AuthCIDs connMyAuthCIDs :: Connection -> IORef AuthCIDs negotiated :: Connection -> IORef Negotiated currentKeyPhase :: Connection -> IORef (Bool, Int) protectors :: Connection -> IOArray EncryptionLevel Protector coders1RTT :: Connection -> IOArray Bool Coder1RTT coders :: Connection -> IOArray EncryptionLevel Coder ciphers :: Connection -> IOArray EncryptionLevel Cipher pendingQ :: Connection -> Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: Connection -> TVar Bool bytesRx :: Connection -> TVar Int bytesTx :: Connection -> TVar Int minIdleTimeout :: Connection -> IORef Microseconds migrationState :: Connection -> TVar MigrationState flowRx :: Connection -> IORef Flow flowTx :: Connection -> TVar Flow peerStreamId :: Connection -> IORef Concurrency myUniStreamId :: Connection -> TVar Concurrency myStreamId :: Connection -> TVar Concurrency streamTable :: Connection -> IORef StreamTable peerPacketNumber :: Connection -> IORef Int delayedAckCancel :: Connection -> IORef (IO ()) delayedAckCount :: Connection -> IORef Int shared :: Connection -> Shared migrationQ :: Connection -> MigrationQ outputQ :: Connection -> OutputQ cryptoQ :: Connection -> CryptoQ inputQ :: Connection -> InputQ peerCIDDB :: Connection -> TVar CIDDB peerParameters :: Connection -> IORef Parameters myCIDDB :: Connection -> IORef CIDDB myParameters :: Connection -> Parameters origVersionInfo :: Connection -> VersionInfo quicVersionInfo :: Connection -> IORef VersionInfo roleInfo :: Connection -> IORef RoleInfo mainThreadId :: Connection -> ThreadId tmouter :: Connection -> IORef (IO ()) readers :: Connection -> IORef (IO ()) udpSocket :: Connection -> IORef UDPSocket connRecvQ :: Connection -> RecvQ connRecv :: Connection -> Recv connSend :: Connection -> Send connHooks :: Connection -> Hooks connQLog :: Connection -> QLogger connDebugLog :: Connection -> DebugLogger connState :: Connection -> ConnState ..} = TVar Concurrency -> Int -> IO () set TVar Concurrency myUniStreamId set :: TVar Concurrency -> Int -> IO () set :: TVar Concurrency -> Int -> IO () set TVar Concurrency tvar Int mx = forall (m :: * -> *) a. MonadIO m => STM a -> m a atomically forall a b. (a -> b) -> a -> b $ forall a. TVar a -> (a -> a) -> STM () modifyTVar TVar Concurrency tvar forall a b. (a -> b) -> a -> b $ \Concurrency c -> Concurrency c { maxStreams :: Int maxStreams = Int mx } setPeerMaxStreams :: Connection -> Int -> IO () setPeerMaxStreams :: Connection -> Int -> IO () setPeerMaxStreams Connection{Recv Buffer Array EncryptionLevel (TVar [ReceivedPacket]) IOArray Bool Coder1RTT IOArray EncryptionLevel Cipher IOArray EncryptionLevel Protector IOArray EncryptionLevel Coder ThreadId TVar Bool TVar Int TVar Flow TVar Concurrency TVar MigrationState TVar CIDDB IORef Int IORef (IO ()) IORef (Bool, Int) IORef UDPSocket IORef Microseconds IORef VersionInfo IORef Flow IORef StreamTable IORef AuthCIDs IORef Parameters IORef Concurrency IORef Negotiated IORef CIDDB IORef RoleInfo MigrationQ OutputQ CryptoQ InputQ VersionInfo RecvQ SizedBuffer ConnState Parameters LDCC Hooks Shared Send DebugLogger QLogger connLDCC :: LDCC decryptBuf :: Buffer encryptRes :: SizedBuffer encodeBuf :: Buffer connResources :: IORef (IO ()) connPeerAuthCIDs :: IORef AuthCIDs connMyAuthCIDs :: IORef AuthCIDs negotiated :: IORef Negotiated currentKeyPhase :: IORef (Bool, Int) protectors :: IOArray EncryptionLevel Protector coders1RTT :: IOArray Bool Coder1RTT coders :: IOArray EncryptionLevel Coder ciphers :: IOArray EncryptionLevel Cipher pendingQ :: Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: TVar Bool bytesRx :: TVar Int bytesTx :: TVar Int minIdleTimeout :: IORef Microseconds migrationState :: TVar MigrationState flowRx :: IORef Flow flowTx :: TVar Flow peerStreamId :: IORef Concurrency myUniStreamId :: TVar Concurrency myStreamId :: TVar Concurrency streamTable :: IORef StreamTable peerPacketNumber :: IORef Int delayedAckCancel :: IORef (IO ()) delayedAckCount :: IORef Int shared :: Shared migrationQ :: MigrationQ outputQ :: OutputQ cryptoQ :: CryptoQ inputQ :: InputQ peerCIDDB :: TVar CIDDB peerParameters :: IORef Parameters myCIDDB :: IORef CIDDB myParameters :: Parameters origVersionInfo :: VersionInfo quicVersionInfo :: IORef VersionInfo roleInfo :: IORef RoleInfo mainThreadId :: ThreadId tmouter :: IORef (IO ()) readers :: IORef (IO ()) udpSocket :: IORef UDPSocket connRecvQ :: RecvQ connRecv :: Recv connSend :: Send connHooks :: Hooks connQLog :: QLogger connDebugLog :: DebugLogger connState :: ConnState connLDCC :: Connection -> LDCC decryptBuf :: Connection -> Buffer encryptRes :: Connection -> SizedBuffer encodeBuf :: Connection -> Buffer connResources :: Connection -> IORef (IO ()) connPeerAuthCIDs :: Connection -> IORef AuthCIDs connMyAuthCIDs :: Connection -> IORef AuthCIDs negotiated :: Connection -> IORef Negotiated currentKeyPhase :: Connection -> IORef (Bool, Int) protectors :: Connection -> IOArray EncryptionLevel Protector coders1RTT :: Connection -> IOArray Bool Coder1RTT coders :: Connection -> IOArray EncryptionLevel Coder ciphers :: Connection -> IOArray EncryptionLevel Cipher pendingQ :: Connection -> Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: Connection -> TVar Bool bytesRx :: Connection -> TVar Int bytesTx :: Connection -> TVar Int minIdleTimeout :: Connection -> IORef Microseconds migrationState :: Connection -> TVar MigrationState flowRx :: Connection -> IORef Flow flowTx :: Connection -> TVar Flow peerStreamId :: Connection -> IORef Concurrency myUniStreamId :: Connection -> TVar Concurrency myStreamId :: Connection -> TVar Concurrency streamTable :: Connection -> IORef StreamTable peerPacketNumber :: Connection -> IORef Int delayedAckCancel :: Connection -> IORef (IO ()) delayedAckCount :: Connection -> IORef Int shared :: Connection -> Shared migrationQ :: Connection -> MigrationQ outputQ :: Connection -> OutputQ cryptoQ :: Connection -> CryptoQ inputQ :: Connection -> InputQ peerCIDDB :: Connection -> TVar CIDDB peerParameters :: Connection -> IORef Parameters myCIDDB :: Connection -> IORef CIDDB myParameters :: Connection -> Parameters origVersionInfo :: Connection -> VersionInfo quicVersionInfo :: Connection -> IORef VersionInfo roleInfo :: Connection -> IORef RoleInfo mainThreadId :: Connection -> ThreadId tmouter :: Connection -> IORef (IO ()) readers :: Connection -> IORef (IO ()) udpSocket :: Connection -> IORef UDPSocket connRecvQ :: Connection -> RecvQ connRecv :: Connection -> Recv connSend :: Connection -> Send connHooks :: Connection -> Hooks connQLog :: Connection -> QLogger connDebugLog :: Connection -> DebugLogger connState :: Connection -> ConnState ..} Int n = forall a. IORef a -> (a -> a) -> IO () atomicModifyIORef'' IORef Concurrency peerStreamId forall a b. (a -> b) -> a -> b $ \Concurrency c -> Concurrency c { maxStreams :: Int maxStreams = Int n } getPeerMaxStreams :: Connection -> IO Int getPeerMaxStreams :: Connection -> IO Int getPeerMaxStreams Connection{Recv Buffer Array EncryptionLevel (TVar [ReceivedPacket]) IOArray Bool Coder1RTT IOArray EncryptionLevel Cipher IOArray EncryptionLevel Protector IOArray EncryptionLevel Coder ThreadId TVar Bool TVar Int TVar Flow TVar Concurrency TVar MigrationState TVar CIDDB IORef Int IORef (IO ()) IORef (Bool, Int) IORef UDPSocket IORef Microseconds IORef VersionInfo IORef Flow IORef StreamTable IORef AuthCIDs IORef Parameters IORef Concurrency IORef Negotiated IORef CIDDB IORef RoleInfo MigrationQ OutputQ CryptoQ InputQ VersionInfo RecvQ SizedBuffer ConnState Parameters LDCC Hooks Shared Send DebugLogger QLogger connLDCC :: LDCC decryptBuf :: Buffer encryptRes :: SizedBuffer encodeBuf :: Buffer connResources :: IORef (IO ()) connPeerAuthCIDs :: IORef AuthCIDs connMyAuthCIDs :: IORef AuthCIDs negotiated :: IORef Negotiated currentKeyPhase :: IORef (Bool, Int) protectors :: IOArray EncryptionLevel Protector coders1RTT :: IOArray Bool Coder1RTT coders :: IOArray EncryptionLevel Coder ciphers :: IOArray EncryptionLevel Cipher pendingQ :: Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: TVar Bool bytesRx :: TVar Int bytesTx :: TVar Int minIdleTimeout :: IORef Microseconds migrationState :: TVar MigrationState flowRx :: IORef Flow flowTx :: TVar Flow peerStreamId :: IORef Concurrency myUniStreamId :: TVar Concurrency myStreamId :: TVar Concurrency streamTable :: IORef StreamTable peerPacketNumber :: IORef Int delayedAckCancel :: IORef (IO ()) delayedAckCount :: IORef Int shared :: Shared migrationQ :: MigrationQ outputQ :: OutputQ cryptoQ :: CryptoQ inputQ :: InputQ peerCIDDB :: TVar CIDDB peerParameters :: IORef Parameters myCIDDB :: IORef CIDDB myParameters :: Parameters origVersionInfo :: VersionInfo quicVersionInfo :: IORef VersionInfo roleInfo :: IORef RoleInfo mainThreadId :: ThreadId tmouter :: IORef (IO ()) readers :: IORef (IO ()) udpSocket :: IORef UDPSocket connRecvQ :: RecvQ connRecv :: Recv connSend :: Send connHooks :: Hooks connQLog :: QLogger connDebugLog :: DebugLogger connState :: ConnState connLDCC :: Connection -> LDCC decryptBuf :: Connection -> Buffer encryptRes :: Connection -> SizedBuffer encodeBuf :: Connection -> Buffer connResources :: Connection -> IORef (IO ()) connPeerAuthCIDs :: Connection -> IORef AuthCIDs connMyAuthCIDs :: Connection -> IORef AuthCIDs negotiated :: Connection -> IORef Negotiated currentKeyPhase :: Connection -> IORef (Bool, Int) protectors :: Connection -> IOArray EncryptionLevel Protector coders1RTT :: Connection -> IOArray Bool Coder1RTT coders :: Connection -> IOArray EncryptionLevel Coder ciphers :: Connection -> IOArray EncryptionLevel Cipher pendingQ :: Connection -> Array EncryptionLevel (TVar [ReceivedPacket]) addressValidated :: Connection -> TVar Bool bytesRx :: Connection -> TVar Int bytesTx :: Connection -> TVar Int minIdleTimeout :: Connection -> IORef Microseconds migrationState :: Connection -> TVar MigrationState flowRx :: Connection -> IORef Flow flowTx :: Connection -> TVar Flow peerStreamId :: Connection -> IORef Concurrency myUniStreamId :: Connection -> TVar Concurrency myStreamId :: Connection -> TVar Concurrency streamTable :: Connection -> IORef StreamTable peerPacketNumber :: Connection -> IORef Int delayedAckCancel :: Connection -> IORef (IO ()) delayedAckCount :: Connection -> IORef Int shared :: Connection -> Shared migrationQ :: Connection -> MigrationQ outputQ :: Connection -> OutputQ cryptoQ :: Connection -> CryptoQ inputQ :: Connection -> InputQ peerCIDDB :: Connection -> TVar CIDDB peerParameters :: Connection -> IORef Parameters myCIDDB :: Connection -> IORef CIDDB myParameters :: Connection -> Parameters origVersionInfo :: Connection -> VersionInfo quicVersionInfo :: Connection -> IORef VersionInfo roleInfo :: Connection -> IORef RoleInfo mainThreadId :: Connection -> ThreadId tmouter :: Connection -> IORef (IO ()) readers :: Connection -> IORef (IO ()) udpSocket :: Connection -> IORef UDPSocket connRecvQ :: Connection -> RecvQ connRecv :: Connection -> Recv connSend :: Connection -> Send connHooks :: Connection -> Hooks connQLog :: Connection -> QLogger connDebugLog :: Connection -> DebugLogger connState :: Connection -> ConnState ..} = forall a b. IORef a -> (a -> (a, b)) -> IO b atomicModifyIORef' IORef Concurrency peerStreamId Concurrency -> (Concurrency, Int) inc where inc :: Concurrency -> (Concurrency, Int) inc Concurrency c = (Concurrency c { maxStreams :: Int maxStreams = Int next}, Int next) where next :: Int next = Concurrency -> Int maxStreams Concurrency c forall a. Num a => a -> a -> a + Int 1