| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Network.LibP2P.Mux.Yamux.Types
Description
Shared types for Yamux session management.
Types follow the HashiCorp yamux spec.md and docs/06-multiplexing.md. SessionRole determines stream ID parity, StreamState tracks the stream lifecycle state machine, and YamuxSession/YamuxStream hold per-session/per-stream mutable state via STM.
Synopsis
- data SessionRole
- data StreamState
- data YamuxError
- data YamuxStream = YamuxStream {
- ysStreamId :: !Word32
- ysState :: !(TVar StreamState)
- ysSendWindow :: !(TVar Word32)
- ysRecvWindow :: !(TVar Word32)
- ysRecvBuf :: !(TQueue ByteString)
- ysSendNotify :: !(TMVar ())
- ysSession :: !YamuxSession
- data YamuxSession = YamuxSession {
- ysRole :: !SessionRole
- ysNextStreamId :: !(TVar Word32)
- ysStreams :: !(TVar (Map Word32 YamuxStream))
- ysAcceptCh :: !(TQueue YamuxStream)
- ysSendCh :: !(TQueue (YamuxHeader, ByteString))
- ysShutdown :: !(TVar Bool)
- ysRemoteGoAway :: !(TVar Bool)
- ysPings :: !(TVar (Map Word32 (TMVar ())))
- ysNextPingId :: !(TVar Word32)
- ysWrite :: !(ByteString -> IO ())
- ysRead :: !(Int -> IO ByteString)
Documentation
data SessionRole Source #
SessionRole determines stream ID parity (spec.md §Stream Identification). Client uses odd IDs (1, 3, 5, ...), Server uses even IDs (2, 4, 6, ...).
Constructors
| RoleClient | |
| RoleServer |
Instances
| Show SessionRole Source # | |
Defined in Network.LibP2P.Mux.Yamux.Types Methods showsPrec :: Int -> SessionRole -> ShowS # show :: SessionRole -> String # showList :: [SessionRole] -> ShowS # | |
| Eq SessionRole Source # | |
Defined in Network.LibP2P.Mux.Yamux.Types | |
data StreamState Source #
Stream state machine (spec.md §Stream OpenCloseReset). States map to the spec's lifecycle: SYN sentreceived -> Established -> FIN sentreceived -> Closed
Constructors
| StreamSYNSent | SYN sent, awaiting ACK (initiator) |
| StreamSYNReceived | SYN received, awaiting local ACK (responder) |
| StreamEstablished | Both SYN/ACK exchanged, data flows |
| StreamLocalClose | Local FIN sent (half-closed) |
| StreamRemoteClose | Remote FIN received (half-closed) |
| StreamClosed | Both FIN'd |
| StreamReset | RST sent or received |
Instances
| Show StreamState Source # | |
Defined in Network.LibP2P.Mux.Yamux.Types Methods showsPrec :: Int -> StreamState -> ShowS # show :: StreamState -> String # showList :: [StreamState] -> ShowS # | |
| Eq StreamState Source # | |
Defined in Network.LibP2P.Mux.Yamux.Types | |
data YamuxError Source #
Errors map to spec-defined conditions.
Constructors
| YamuxProtocolError !String | Spec violation (e.g., invalid version, unknown frame type) |
| YamuxStreamClosed | Write/read on closed stream |
| YamuxStreamReset | RST received |
| YamuxSessionShutdown | GoAway received or session closed |
| YamuxGoAway !GoAwayCode | Remote sent GoAway with specific code |
Instances
| Show YamuxError Source # | |
Defined in Network.LibP2P.Mux.Yamux.Types Methods showsPrec :: Int -> YamuxError -> ShowS # show :: YamuxError -> String # showList :: [YamuxError] -> ShowS # | |
| Eq YamuxError Source # | |
Defined in Network.LibP2P.Mux.Yamux.Types | |
data YamuxStream Source #
Per-stream state (spec.md §Flow Control: per-stream windows only).
Constructors
| YamuxStream | |
Fields
| |
data YamuxSession Source #
Session state.
Constructors
| YamuxSession | |
Fields
| |