cancel_message
Description:
Causes this 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 this; if this
has started sending the request but has not yet received the complete response, then it will close the request's connection. Note that
with requests that have side effects (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.
Beware that with the deprecated SessionAsync, messages queued with queue_message will have their callbacks invoked before cancel_message returns. The plain Session does not have this behavior; cancelling an asynchronous message will merely queue its callback to be run after returning to the main loop.
Parameters:
this |
a Session |
msg |
the message to cancel |
status_code |
status code to set on |