Valadoc | Vala | Tutorial | API-References | Markup

cancel_message


Description:

public virtual void cancel_message (Message msg, uint status_code)

Causes session to immediately finish processing msg (regardless of its current state) with a final status_code of status_code. You may call this at any time after handing msg off to session; if session has started sending the request but has not yet received the complete response, then it will close the request's connection. Note that with non-idempotent requests (eg, POST, PUT, DELETE) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state.

If the message is cancelled while its response body is being read, then the response body in msg will be left partially-filled-in. The response headers, on the other hand, will always be either empty or complete.

For messages queued with queue_message (and cancelled from the same thread), the callback will be invoked before cancel_message returns.

Parameters:

msg the message to cancel
status_code status code to set on msg (generally CANCELLED)