rsocket / rsocket-rust

RSocket Rust Implementation using Tokio
Apache License 2.0
199 stars 20 forks source link

feat: implemented cancel frame handling #49

Closed yuriykulikov closed 2 years ago

yuriykulikov commented 2 years ago

This closes Support CANCEL Frames for Request-Stream #48

Client will send a CANCEL frame for a dropped stream when the next payload is received for this stream and the server will inform the RSocket implementation that the stream is closed.

Motivation:

Closing the streams upon reception of a CANCEL frame allows to free up the resources (for example memory allocated for buffers).

Modifications:

For the client: in on_payload() check is_closed() and send CANCEL Frame if downstream is closed. For the server: Streams returned by the RSocket implementation are wrapped in Aborable. When the CANCEL Frame is received, this Abortable is aborted.

Result:

CANCEL frames are send by the client and handled by the server.

jjeffcaii commented 2 years ago

@yuriykulikov Thanks for your hard work! 👍

yuriykulikov commented 2 years ago

@jjeffcaii thank you for a prompt review! I will be happy to make more contributions if I can.