To fix a bug that caused assertion failure in ares_strerror:

* src/NameResolver.cc (callback): Fixed the bug.
pull/1/head
Tatsuhiro Tsujikawa 2006-08-28 13:30:24 +00:00
parent c096a3a553
commit d63e6fb052
3 changed files with 15 additions and 3 deletions

View File

@ -8,6 +8,9 @@
(executeInternal): Made filename URL-decoded.
* src/Util.h (urldecode): New function.
* src/Util.cc (urldecode): New function.
To fix a bug that caused assertion failure in ares_strerror:
* src/NameResolver.cc (callback): Fixed the bug.
2006-08-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

View File

@ -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);

View File

@ -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;