cURL / Mailing Lists / curl-library / Single Mail

curl-library

Curl_resolv and OOM

From: Yang Tse <yangsita_at_gmail.com>
Date: Thu, 27 Oct 2011 17:06:19 +0200

Daniel,

Currently there's now way for code calling Curl_resolv() to tell apart
an OOM condition from a failed resolve (bad or non existing address).
Currently Curl_resolv() returns CURLRESOLV_ERROR for both results.

There are code paths that use this function and upon failure 'retries'
operation with next address. But if the failure is actually due to an
OOM condition code should not retry and allow proper cleanup. IOW we
need to differentiate between 'OOM failure' or 'resolve failure'.

We have at least two options.

1) Allow Curl_resolv() to return a new CURLRESOLV_ERROR_NOMEM or
CURLRESOLV_NOMEM for OOM failed result, and return CURLRESOLV_ERROR
for 'inability to resolve due to any other reasons'.

2) No new return code. Return CURLRESOLV_ERROR for OOM failed result,
and return CURLRESOLV_RESOLVED with pointer set to NULL for 'inability
to resolve due to any other reasons'.

Minor adjustments required where function is used in any case.

Which option do you prefer?

-- 
-=[Yang]=-
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-10-27