aboutsummaryrefslogtreecommitdiff
path: root/lib/urldata.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-07-07 22:58:06 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-07-07 22:58:06 +0000
commitca319f63ad757a69f14105ab4a8bbf10987b8ad0 (patch)
treed50690605fefd4ea78795d68068a4425bc9494b2 /lib/urldata.h
parenta09a8164db637b35de52bdea757e8ea930f28eaf (diff)
Ingmar Runge provided a source snippet that caused a crash. The reason for
the crash was that libcurl internally was a bit confused about who owned the DNS cache at all times so if you created an easy handle that uses a shared DNS cache and added that to a multi handle it would crash. Now we keep more careful internal track of exactly what kind of DNS cache each easy handle uses: None, Private (allocated for and used only by this single handle), Shared (points to a cache held by a shared object), Global (points to the global cache) or Multi (points to the cache within the multi handle that is automatically shared between all easy handles that are added with private caches).
Diffstat (limited to 'lib/urldata.h')
-rw-r--r--lib/urldata.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/urldata.h b/lib/urldata.h
index 834741fcc..63ccfe70a 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1145,19 +1145,29 @@ struct UserDefined {
bool connect_only; /* make connection, let application use the socket */
};
+struct Names {
+ struct curl_hash *hostcache;
+ enum {
+ HCACHE_NONE, /* not pointing to anything */
+ HCACHE_PRIVATE, /* points to our own */
+ HCACHE_GLOBAL, /* points to the (shrug) global one */
+ HCACHE_MULTI, /* points to a shared one in the multi handle */
+ HCACHE_SHARED /* points to a shared one in a shared object */
+ } hostcachetype;
+};
+
/*
- * In August 2001, this struct was redesigned and is since stricter than
- * before. The 'connectdata' struct MUST have all the connection oriented
- * stuff as we may now have several simultaneous connections and connection
- * structs in memory.
+ * The 'connectdata' struct MUST have all the connection oriented stuff as we
+ * may have several simultaneous connections and connection structs in memory.
*
- * From now on, the 'SessionHandle' must only contain data that is set once to
- * go for many (perhaps) independent connections. Values that are generated or
+ * The 'struct UserDefined' must only contain data that is set once to go for
+ * many (perhaps) independent connections. Values that are generated or
* calculated internally for the "session handle" must be defined within the
- * 'struct UrlState' instead. */
+ * 'struct UrlState' instead.
+ */
struct SessionHandle {
- struct curl_hash *hostcache;
+ struct Names dns;
struct Curl_multi *multi; /* if non-NULL, points to the multi handle
struct of which this "belongs" */
struct Curl_share *share; /* Share, handles global variable mutexing */