0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

Was not properly passing the host parameter to Acceptor::Listen.

This commit is contained in:
Ryan 2009-05-13 23:44:05 +02:00
parent 740139408d
commit 8d00691f78

View File

@ -435,14 +435,14 @@ Acceptor::v8Listen (const Arguments& args)
if (args.Length() < 1) if (args.Length() < 1)
return ThrowException(String::New("Must give at least a port as argument.")); return ThrowException(String::New("Must give at least a port as argument."));
char *host = NULL;
HandleScope scope; HandleScope scope;
String::AsciiValue port(args[0]->ToString()); String::AsciiValue port(args[0]->ToString());
char *host = NULL;
if (args[1]->IsString()) { if (args[1]->IsString()) {
String::Utf8Value host_sv(args[1]->ToString()); String::Utf8Value host_sv(args[1]->ToString());
host = *host_sv; host = strdup(*host_sv);
} }
// For servers call getaddrinfo inline. This is blocking but it shouldn't // For servers call getaddrinfo inline. This is blocking but it shouldn't
@ -453,6 +453,8 @@ Acceptor::v8Listen (const Arguments& args)
if (r != 0) if (r != 0)
return ThrowException(String::New(strerror(errno))); return ThrowException(String::New(strerror(errno)));
free(host);
acceptor->Listen(address); acceptor->Listen(address);
return Undefined(); return Undefined();
} }