| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 615273d commit e9327d1
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2159,13 +2159,13 @@ void SetServers(const FunctionCallbackInfo<Value>& args) { | |||
| 2159 | 2159 | if (!elm->Get(env->context(), 1).ToLocal(&ipValue)) return; | |
| 2160 | 2160 | if (!elm->Get(env->context(), 2).ToLocal(&portValue)) return; | |
| 2161 | 2161 | ||
| 2162 | - CHECK(familyValue->Int32Value(env->context()).FromJust()); | ||
| 2162 | + CHECK(familyValue->IsInt32()); | ||
| 2163 | 2163 | CHECK(ipValue->IsString()); | |
| 2164 | - CHECK(portValue->Int32Value(env->context()).FromJust()); | ||
| 2164 | + CHECK(portValue->IsInt32()); | ||
| 2165 | 2165 | ||
| 2166 | - int fam = familyValue->Int32Value(env->context()).FromJust(); | ||
| 2166 | + int32_t fam = familyValue.As<Int32>()->Value(); | ||
| 2167 | 2167 | node::Utf8Value ip(env->isolate(), ipValue); | |
| 2168 | - int port = portValue->Int32Value(env->context()).FromJust(); | ||
| 2168 | + int32_t port = portValue.As<Int32>()->Value(); | ||
| 2169 | 2169 | ||
| 2170 | 2170 | ares_addr_port_node* cur = &servers[i]; | |
| 2171 | 2171 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -136,6 +136,10 @@ const portsExpected = [ | |||
| 136 | 136 | dns.setServers(ports); | |
| 137 | 137 | assert.deepStrictEqual(dns.getServers(), portsExpected); | |
| 138 | 138 | ||
| 139 | + // Port 0 means "use the default port" for c-ares. | ||
| 140 | + dns.setServers(['4.4.4.4:0', '[2001:4860:4860::8888]:0']); | ||
| 141 | + assert.deepStrictEqual(dns.getServers(), ['4.4.4.4', '2001:4860:4860::8888']); | ||
| 142 | + | ||
| 139 | 143 | dns.setServers([]); | |
| 140 | 144 | assert.deepStrictEqual(dns.getServers(), []); | |
| 141 | 145 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments