Skip to content

Commit

Permalink
Fix dns bug - first cb arg wasn't null
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Feb 22, 2010
1 parent e8363ab commit 6ee0bf7
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/node_dns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ static void ResolveError(Handle<Function> *cb) {
Local<Object> obj = e->ToObject();
obj->Set(errno_symbol, Integer::New(status));

TryCatch try_catch;

(*cb)->Call(Context::GetCurrent()->Global(), 1, &e);

if (try_catch.HasCaught()) {
FatalException(try_catch);
}
}

static void AfterResolveA4(struct dns_ctx *ctx,
Expand Down Expand Up @@ -121,11 +127,11 @@ static void AfterResolveA4(struct dns_ctx *ctx,
addresses->Set(Integer::New(i), address);
}

Local<Value> argv[3] = { addresses, ttl, cname };
Local<Value> argv[4] = { Local<Value>::New(Null()), addresses, ttl, cname };

TryCatch try_catch;

(*cb)->Call(Context::GetCurrent()->Global(), 3, argv);
(*cb)->Call(Context::GetCurrent()->Global(), 4, argv);

if (try_catch.HasCaught()) {
FatalException(try_catch);
Expand Down Expand Up @@ -166,11 +172,11 @@ static void AfterResolveA6(struct dns_ctx *ctx,
addresses->Set(Integer::New(i), address);
}

Local<Value> argv[3] = { addresses, ttl, cname };
Local<Value> argv[4] = { Local<Value>::New(Null()), addresses, ttl, cname };

TryCatch try_catch;

(*cb)->Call(Context::GetCurrent()->Global(), 3, argv);
(*cb)->Call(Context::GetCurrent()->Global(), 4, argv);

if (try_catch.HasCaught()) {
FatalException(try_catch);
Expand Down Expand Up @@ -213,11 +219,11 @@ static void AfterResolveMX(struct dns_ctx *ctx,
exchanges->Set(Integer::New(i), exchange);
}

Local<Value> argv[3] = { exchanges, ttl, cname };
Local<Value> argv[4] = { Local<Value>::New(Null()), exchanges, ttl, cname };

TryCatch try_catch;

(*cb)->Call(Context::GetCurrent()->Global(), 3, argv);
(*cb)->Call(Context::GetCurrent()->Global(), 4, argv);

if (try_catch.HasCaught()) {
FatalException(try_catch);
Expand Down Expand Up @@ -256,11 +262,11 @@ static void AfterResolveTXT(struct dns_ctx *ctx,
records->Set(Integer::New(i), String::New(txt));
}

Local<Value> argv[3] = { records, ttl, cname };
Local<Value> argv[4] = { Local<Value>::New(Null()), records, ttl, cname };

TryCatch try_catch;

(*cb)->Call(Context::GetCurrent()->Global(), 3, argv);
(*cb)->Call(Context::GetCurrent()->Global(), 4, argv);

if (try_catch.HasCaught()) {
FatalException(try_catch);
Expand Down Expand Up @@ -305,11 +311,11 @@ static void AfterResolveSRV(struct dns_ctx *ctx,
records->Set(Integer::New(i), record);
}

Local<Value> argv[3] = { records, ttl, cname };
Local<Value> argv[4] = { Local<Value>::New(Null()), records, ttl, cname };

TryCatch try_catch;

(*cb)->Call(Context::GetCurrent()->Global(), 3, argv);
(*cb)->Call(Context::GetCurrent()->Global(), 4, argv);

if (try_catch.HasCaught()) {
FatalException(try_catch);
Expand Down Expand Up @@ -411,11 +417,11 @@ static void AfterReverse(struct dns_ctx *ctx,
domains->Set(Integer::New(i), domain);
}

Local<Value> argv[3] = { domains, ttl, cname };
Local<Value> argv[4] = { Local<Value>::New(Null()), domains, ttl, cname };

TryCatch try_catch;

(*cb)->Call(Context::GetCurrent()->Global(), 3, argv);
(*cb)->Call(Context::GetCurrent()->Global(), 4, argv);

if (try_catch.HasCaught()) {
FatalException(try_catch);
Expand Down

0 comments on commit 6ee0bf7

Please sign in to comment.