Non-templated base class for outbound RPC handles (Writer and UnaryWriter), to share code across writer types.
|
| enum | OnDestroy : bool { kFinishOnDestroy = false
, kErrorOnDestroy = true
} |
| |
◆ OnDestroy
◆ Cancel()
| void pw::rpc2::internal::WriterBase::Cancel |
( |
| ) |
|
|
inline |
Aborts the call immediately, closing this writer and sending kCancelled to the peer.
Unlike Finish(), which indicates normal completion of the stream or RPC, Cancel() terminates the RPC in both directions. The peer's pending or next read fails with kCancelled, and so does this end's: the call completes locally with kCancelled, so a client's Reader or response future resolves instead of waiting for a server that will not answer. A write still in flight is rejected rather than sent.
◆ is_closed()
| bool pw::rpc2::internal::WriterBase::is_closed |
( |
| ) |
const |
|
inline |
Returns true if no further writes can be initiated through this writer.
This becomes true once Finish() (or ReserveFinish()) is called, Cancel() is called, the peer cancels or finishes the call, or the connection closes. Server handlers can check is_closed() between async steps to stop work early if the client has disconnected or cancelled.
◆ max_write_size_bytes()
| size_t pw::rpc2::internal::WriterBase::max_write_size_bytes |
( |
| ) |
const |
|
inline |
Returns the maximum size, in bytes, of a message that can be written through this writer. Returns 0 if is_closed().
0-length writes are valid, so do not rely on this function to determine whether the writer is closed; call is_closed() instead.
The documentation for this class was generated from the following file:
- pw_rpc2/cpp/public/pw_rpc2/writer.h