diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-08-28 13:30:24 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-08-28 13:30:24 +0000 |
| commit | d63e6fb052ae5881abd265b10eb457bba27490d1 (patch) | |
| tree | 248231cb17800ae9e06449e82525ee457847cc47 /src | |
| parent | c096a3a55386d8b801196729a169162bec7f41e1 (diff) | |
To fix a bug that caused assertion failure in ares_strerror:
* src/NameResolver.cc (callback): Fixed the bug.
Diffstat (limited to 'src')
| -rw-r--r-- | src/NameResolver.cc | 9 | ||||
| -rw-r--r-- | src/SharedHandle.h | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/NameResolver.cc b/src/NameResolver.cc index d9d124c8..dc048549 100644 --- a/src/NameResolver.cc +++ b/src/NameResolver.cc @@ -23,6 +23,15 @@ void callback(void* arg, int status, struct hostent* host) { NameResolver* resolverPtr = (NameResolver*)arg; +#ifdef HAVE_LIBARES + // This block is required since the assertion in ares_strerror fails + // if status = ARES_EDESTRUCTION is passed to ares_strerror as 1st argument. + // This does not happen in c-ares. + if(status == ARES_EDESTRUCTION) { + // we simply return in this case. + return; + } +#endif if(status != ARES_SUCCESS) { #ifdef HAVE_LIBCARES resolverPtr->error = ares_strerror(status); diff --git a/src/SharedHandle.h b/src/SharedHandle.h index a346fff4..2d7e8c2c 100644 --- a/src/SharedHandle.h +++ b/src/SharedHandle.h @@ -47,7 +47,7 @@ private: public: SharedHandle():obj(new T()), ucount(new int(1)) {} SharedHandle(T* obj):obj(obj), ucount(new int(1)) {} - SharedHandle(const SharedHandle<T>& t):obj(t.get()), ucount(t.getRefCount()) { + SharedHandle(const SharedHandle& t):obj(t.get()), ucount(t.getRefCount()) { ++*ucount; } template<class S> @@ -62,7 +62,7 @@ public: } } - SharedHandle<T>& operator=(const SharedHandle<T>& t) { + SharedHandle& operator=(const SharedHandle& t) { ++*t.getRefCount(); if(--*ucount == 0) { delete obj; @@ -73,7 +73,7 @@ public: return *this; } template<class S> - SharedHandle<T>& operator=(const SharedHandle<S>& t) { + SharedHandle& operator=(const SharedHandle<S>& t) { ++*t.getRefCount(); if(--*ucount == 0) { delete obj; |
