File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2275,13 +2275,13 @@ void SetServers(const FunctionCallbackInfo<Value>& args) {
22752275 if (!elm->Get (env->context (), 1 ).ToLocal (&ipValue)) return ;
22762276 if (!elm->Get (env->context (), 2 ).ToLocal (&portValue)) return ;
22772277
2278- CHECK (familyValue->Int32Value (env-> context ()). FromJust ());
2278+ CHECK (familyValue->IsInt32 ());
22792279 CHECK (ipValue->IsString ());
2280- CHECK (portValue->Int32Value (env-> context ()). FromJust ());
2280+ CHECK (portValue->IsInt32 ());
22812281
2282- int fam = familyValue-> Int32Value (env-> context ()). FromJust ();
2282+ int32_t fam = familyValue. As <Int32>()-> Value ();
22832283 node::Utf8Value ip (env->isolate (), ipValue);
2284- int port = portValue-> Int32Value (env-> context ()). FromJust ();
2284+ int32_t port = portValue. As <Int32>()-> Value ();
22852285
22862286 if (!csv.empty ()) csv += ' ,' ;
22872287
Original file line number Diff line number Diff line change @@ -134,6 +134,10 @@ const portsExpected = [
134134dns . setServers ( ports ) ;
135135assert . deepStrictEqual ( dns . getServers ( ) , portsExpected ) ;
136136
137+ // Port 0 means "use the default port" for c-ares.
138+ dns . setServers ( [ '4.4.4.4:0' , '[2001:4860:4860::8888]:0' ] ) ;
139+ assert . deepStrictEqual ( dns . getServers ( ) , [ '4.4.4.4' , '2001:4860:4860::8888' ] ) ;
140+
137141// Link-local IPv6 addresses require a zone index (scope id) to be usable;
138142// c-ares drops link-local servers configured without one.
139143dns . setServers ( [ '[fe80::483a:5aff:fee6:1f04]%eth0' ] ) ;
You can’t perform that action at this time.
0 commit comments