demux runs as a single separate thread and reads complete SDUs from the underlying Bearer and forwards it to the matching ingress queue.
Modulenetwork-mux-0.11.0.0Haskell2010
Network.Mux.Ingress
- 1 value
- Packagenetwork-mux-0.11.0.0
- Exports1
- LanguageHaskell2010
- LicenceApache-2.0
- SourceIngress.hs
Ingress Path
●
│
│ ByteStrings
│
░░░░░░░░░▼░░░░░░░░░
░┌───────────────┐░
░│ Bearer.read() │░ Mux Bearer implementation (Socket, Pipes, etc.)
░└───────────────┘░
░░░░░░░░░│░░░░░░░░░
░│░ SDUs
░░░░░░░░░▼░░░░░░░░░
░┌───────────────┐░
░│ demux │░ For a given Mux Bearer there is a single demux
░└───────┬───────┘░ thread reading from the underlying bearer.
░░░░░░░░░│░░░░░░░░░
░│░
░░░░░░░░░░▼░░░░░░░░░░
░ ╭────┬────┬─────╮ ░ There is a limited queue (in bytes) for each mode
░ │ │ │ │ ░ (responder/initiator) per miniprotocol. Overflowing
░ ▼ ▼ ▼ ▼ ░ a queue is a protocol violation and a
░│ │ │ │ │ │ │ │░ IngressQueueOverRun exception is thrown
░│ci│ │ │ │bi│ │br│░ and the bearer torn down.
░│ci│ │cr│ │bi│ │br│░
░└──┘ └──┘ └──┘ └──┘░ Every ingress queue has a dedicated thread which will
░░│░░░░│░░░░│░░░░│░░░ read application encoded data from its queue.
│ │ │ │
application data
│ │ │ │
▼ │ │ ▼
┌───────────┐ │ │ ┌───────────┐
│ muxDuplex │ │ │ │ muxDuplex │
│ Initiator │ │ │ │ Responder │
│ ChainSync │ │ │ │ BlockFetch│
└───────────┘ │ │ └───────────┘
▼ ▼
┌───────────┐ ┌───────────┐
│ muxDuplex │ │ muxDuplex │
│ Responder │ │ Initiator │
│ ChainSync │ │ BlockFetch│
└───────────┘ └───────────┘