Source
Edit
Channel half-closed states
| State | Closed local | Closed remote
|=============================================
| Read | Yes (until EOF) | No
| Write | No | Yes
Channels are considered fully closed when both outgoing and incoming
directions are closed and when the reader of the channel has read the
EOF marker
proc init(L: type LPChannel; id: uint64; conn: RawConn; initiator: bool;
name: string = ""; timeout: Duration = DefaultChanTimeout): LPChannel {.
...raises: [].}
-
Source
Edit
proc open(s: LPChannel): InternalRaisesFuture[void,
(CancelledError, LPStreamError)] {....stackTrace: false, raises: [], gcsafe,
raises: [], tags: [RootEffect],
forbids: [].}
-
Source
Edit
proc resetChannel(s: LPChannel; isLocal: bool): InternalRaisesFuture[void, void] {.
...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect],
forbids: [].}
-
Source
Edit
method close(s: LPChannel): InternalRaisesFuture[void, void] {.
...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect],
forbids: [].}
-
Close channel for writing - a message will be sent to the other peer informing them that the channel is closed and that we're waiting for their acknowledgement.
Source
Edit
method closeWrite(s: LPChannel): InternalRaisesFuture[void, void] {.
...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect],
forbids: [].}
-
For mplex, closeWrite is the same as close - it implements half-close
Source
Edit
method readOnce(s: LPChannel; pbytes: pointer; nbytes: int): InternalRaisesFuture[
int, (CancelledError, LPStreamError)] {....stackTrace: false, raises: [],
gcsafe, raises: [], tags: [RootEffect], forbids: [].}
-
Mplex relies on reading being done regularly from every channel, or all channels are blocked - in particular, this means that reading from one channel must not be done from within a callback / read handler of another or the reads will lock each other.
Source
Edit
method resetImpl(s: LPChannel): InternalRaisesFuture[void, void] {.
...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect],
forbids: [].}
-
Source
Edit
method write(s: LPChannel; msg: sink seq[byte]): InternalRaisesFuture[void,
(CancelledError, LPStreamError)] {....stackTrace: false, raises: [], gcsafe,
raises: [], tags: [RootEffect],
forbids: [].}
-
Source
Edit
DNS_OR_IP, shortLog, init, random, UDP_DNS, $, MaError, libp2p_network_bytes, writeField, ephemeral, replaceIp, MaPatternOp, ==, WS_DNS, initVBuffer, <=, MaxSizeError, decode, ==, shortLog, filterIt, ECDHEScheme, shortLog, hash, supportsPacked, writeField, init, closed, [], shuffle, random, init, Secret, peekVarint, payload, $, validate, mapOr, chroniclesFormatItIMPL, init, Memory, bytes, publicRoutableAddressPolicy, getPubKey, maxInlineKeyLength, TranscoderDNS, QUIC, writeField, [], init, ephemeral, withValue, PeerInfoObserver, getIp, generateBytes, WS_IP, write, MAKind, decode, getBytes, write, decode, init, noPrivateAddressPolicy, getRepeatedField, generate, matchPartial, getBytes, len, areAddrsConsistent, init, readLp, HTTP, initVBuffer, atEof, LPStreamTrackerName, removeObserver, peekSeq, update, TCP_IP4, toOpt, join, fullAddrs, payloadType, LPStreamError, init, IP, protoAddress, QUIC_V1_IP, newRng, ==, shortLog, withValue, checkValid, getPublicKey, chroniclesFormatItIMPL, libp2p_multiaddress_exts, WebSockets, readFieldInto, getPart, CircuitRelay, extractPublicKey, mapAnd, new, maErr, computeFieldSize, UDP_IP, newLPStreamEOFError, init, random, ==, DNSADDR, AddressMapper, write, notifyObservers, WSS, QUIC_V1, TCP_IP, close, init, closeImpl, toCidString, readSeq, toBytes, TCP_DNS, closeWrite, shortLog, wasResetLocally, encode, UDP_IP4, len, capLen, init, protoName, protoArgument, toRawBytes, supportsPacked, $, writeField, TCP_IP6, init, DNS, WSS_DNS, match, writeLPVarint, CryptoResult, LPStream, parseFullAddress, WebRTCDirect, PeerAddressPolicy, init, $, UDP, PeerInfo, TranscoderOnion, StreamTracker, defaultAddressPolicy, init, LPStreamResetError, writeArray, LPStreamIncompleteError, PeerId, >, [], LPStreamEOFError, IP6, shortLog, reset, initVBuffer, PKScheme, random, stretchKeys, accepts, addObserver, Connection, write, init, generate, TCP, PrivateKey, readFieldInto, write, init, RawConn, &=, PeerInfoError, newBearSslRng, verify, newLPStreamClosedError, random, TranscoderMemory, toString, TranscoderIP4, init, toException, init, goffset, getRawBytes, pick, KeyPair, init, high, cmp, init, DefaultConnectionTimeout, Signature, chroniclesFormatItIMPL, contains, hash, exclIfIt, computeFieldSize, computeFieldSize, supportsPacked, stripPeerId, toBytes, DigestSheme, IPFS, getField, shortLog, readOnce, init, resetImpl, isEmpty, shortLog, data, chroniclesFormatItIMPL, hex, protocols, chroniclesFormatItIMPL, computeFieldSize, HTTPS, UNIX, LPError, supportsPacked, readFieldInto, TLS_WS, sign, encode, Rng, getProtocolArgument, supported, MaResult, init, supportsPacked, toBytes, QUIC_V1_IP4, writeSeq, finish, &, DNS6, expandAddrs, writeField, decode, IpTransportProtocol, key, IP4, TranscoderPort, getBytes, readFieldInto, DNSANY, >=, QUIC_V1_DNS, payloadDomain, $, MaPattern, withValue, MuxedStream, init, LPStreamLimitError, TranscoderOnion3, SignedPayload, mac, toBytes, protoArgument, newLPStreamLimitError, keyOpenArray, match, WebSockets_DNS, SignedPeerRecord, $, isEmpty, writeLp, toCid, init, newLPStreamIncompleteError, MAProtocol, newLPStreamResetError, initStream, init, getField, DNS4, readFieldInto, getWrapped, selectBest, supportsPacked, P2PPattern, Envelope, hasPublicKey, toException, init, Stream, isEnough, Reliable, addrs, hex, closeImpl, getBytes, ivOpenArray, WS, init, encode, take, init, init, match, readArray, filterAddrs, <, iv, readLine, Eof, CryptoError, computeFieldSize, append, hash, init, parseFullAddress, WSS_IP, LPStreamConnDownError, peekArray, PeerRecord, SupportedSchemes, generate, QUIC_DNS, Unreliable, SupportedSchemesInt, random, checkFutures, supportsPacked, macOpenArray, init, checkAddresses, validate, protoCode, mapEq, libp2p_pki_schemes, Onion3, TcpOnion3, toFullAddress, pickOne, concat, TranscoderP2P, AddressInfo, ConnectionTrackerName, TranscoderIP6, new, write, EnvelopeError, computeFieldSize, encode, len, newLPStreamRemoteClosedError, TranscoderIP6Zone, MaPatResult, Direction, init, InvalidVarintError, shortLog, items, init, write, write, init, UTP, readVarint, verify, readFieldInto, TimeoutHandler, QUIC_IP, init, PublicKey, WebSockets_IP, VBuffer, writeLp, writePBVarint, toChunks, readExactly, newLPStreamConnDownError, init, initStream, MultiAddress, supportsPacked, readVarint, toOpt, closeWithEOF, RsaDefaultKeySize, orError, LPStreamRemoteClosedError, <, MaInvalidAddress, generate, LPStreamClosedError, writeField, write, getOrder, TranscoderUnix, toOpt, writeVarint