RpcWriteBacklog class final

Stops reading a peer while too much of what was written to it is unsent.

A server answers every call, and part of an answer (headers, trailers) is outside flow control. A peer that reads nothing and keeps starting calls is therefore answered into a write queue without end, unless the server stops reading it. Past maxUnsentBytes unsent, the reader given to attachReader is paused until half has gone out.

The reader also resumes when the write ends, failed or not: a reader left paused holds back the done event of a socket that failed or was destroyed, and the connection never ends.

For a server only: if both ends paused, each would wait for the other to read.

Constructors

RpcWriteBacklog({required int? maxUnsentBytes})
A backlog that pauses past maxUnsentBytes; null never pauses.

Properties

hashCode → int
The hash code for this object.
no setterinherited
maxUnsentBytes → int?
Unsent bytes past which reading stops, or null.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

attachReader(StreamSubscription<Object?> reader) → void
The reader to pause. Paused at once if the backlog is already over.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pipe(Stream<List<int>> source, StreamConsumer<List<int>> sink) → Future<void>
Writes source to sink through addStream, counting what sink has not taken yet.
reads<T>(Stream<T> incoming, {bool admit(T data)?}) → Stream<T>
incoming as a stream whose reader is the one this pauses: the form for a connection whose bytes go on to someone else's parser.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

defaultServerMax → const int
The bound every rpc_dart server uses.