rust-http2 icon indicating copy to clipboard operation
rust-http2 copied to clipboard

Cancel calls

Open stepancheg opened this issue 8 years ago • 0 comments
trafficstars

Need to have an API to cancel calls by client.

When call is cancelled, RST_STREAM is sent.

Client needs an API to cancel calls, and server needs an API to be notified of cancelled call.

One idea is that start_request should have additional Context param:

fn start_request(&self, context: Context, headers: Headers, req: HttpPartStream)
    -> Response;

struct Context(...);

impl Context {
    fn new() -> Context { ... }

    // for client
    fn cancel(&self) { ... }

    // for the server to subscribe for cancel
    fn wait_cancel(&self) -> HttpFutureSend<()> { ... }
}

stepancheg avatar May 13 '17 18:05 stepancheg