Aborting a GET in progress
Joe Orton
joe at manyfish.co.uk
Thu Mar 18 04:50:03 EDT 2010
Hi Jeff!
On Wed, Mar 17, 2010 at 08:00:04PM -0400, Jeff Johnson wrote:
> Is it feasible to abort a GET operation in progress but
> preserve the connection session for performance?
To "abort" a request it's necessary to either read the entire response
body off the connection, or close it.
> Is it sufficient to destroy a request to abort an operation
> or should I proceed to attempt ne_close_connection() or
> even destroy/recreate the session in order to abort a
> transfer in progress?
Destroying the request object then calling ne_close_connection() would
be sufficient.
I'm presuming you are using ne_begin_request()/ne_end_request(), and
that you have a good estimate of the total response length based on the
RPM header metadata from the response block(s) which are read?
You have a trade-off: reading and discarding the entire response may be
slow if it's huge, but, if it's small then it may be faster than closing
the connection and re-opening. I'd recommend some kind of heuristic:
if expected-response-length < 256K (maybe):
ne_discard_response()
ne_end_request()
ne_request_destroy()
else:
ne_request_destroy()
close connection
Regards, Joe
More information about the neon
mailing list