libp2p-hs-0.1.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

Network.LibP2P.Mux.Yamux.Stream

Description

Yamux stream operations: read, write, close, reset.

Implements per-stream data transfer with flow control per HashiCorp yamux spec.md §DataWindowUpdateStream Close.

Synopsis

Documentation

streamWrite :: YamuxStream -> ByteString -> IO (Either YamuxError ()) Source #

Write data to a stream. Blocks when send window is 0. Writable states: SYNSent (optimistic), Established, RemoteClose. Returns YamuxStreamClosed on LocalClose/Closed. Returns YamuxStreamReset on Reset.

streamRead :: YamuxStream -> IO (Either YamuxError ByteString) Source #

Read data from a stream. Blocks on empty buffer. Readable states: SYNSent, SYNReceived, Established, LocalClose, RemoteClose (draining). Returns YamuxStreamClosed on Closed/RemoteClose with empty buffer. Returns YamuxStreamReset on Reset.

streamClose :: YamuxStream -> IO (Either YamuxError ()) Source #

Half-close the stream by sending FIN flag. Only valid in Established or RemoteClose states.

streamReset :: YamuxStream -> IO () Source #

Reset the stream by sending RST flag.