Permalink
Browse files

net, bugfix: result error in net.resolve when host is unknown.

  • Loading branch information...
xicilion committed Jun 5, 2018
1 parent 0f37b62 commit 917fac2e2bc6d190de440b6fa1ed1d9caa929753
Showing with 8 additions and 2 deletions.
  1. +3 −2 fibjs/src/net/net.cpp
  2. +5 −0 test/net_test.js
View
@@ -98,8 +98,9 @@ result_t net_base::resolve(exlib::string name, int32_t family,
addrinfo* result = NULL;
addrinfo* ptr = NULL;
if (getaddrinfo(name.c_str(), NULL, &hints, &result))
return CHECK_ERROR(SocketError());
int res = getaddrinfo(name.c_str(), NULL, &hints, &result);
if (res)
return CHECK_ERROR(-res);
for (ptr = result; ptr != NULL; ptr = ptr->ai_next)
if (ptr->ai_family == addr_info.addr4.sin_family) {
View
@@ -112,6 +112,11 @@ describe("net", () => {
conn_socket();
conn();
assert.throws(() => {
var s1 = new net.Socket(net_config.family, net.SOCK_STREAM);
s1.connect("999.999.999.999", 8080 + base_port);
});
});
it("copyTo", () => {

0 comments on commit 917fac2

Please sign in to comment.