File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -276,14 +276,9 @@ void TCPWrap::Listen(const FunctionCallbackInfo<Value>& args) {
276
276
}
277
277
278
278
void TCPWrap::Connect (const FunctionCallbackInfo<Value>& args) {
279
- if (args.Length () <= 2 ) {
280
- args.GetIsolate ()->ThrowException (v8::Exception::TypeError (
281
- v8::String::NewFromUtf8 (args.GetIsolate (), " Insufficient arguments" )
282
- .ToLocalChecked ()));
283
- return ;
284
- }
285
-
286
- CHECK (args[2 ]->IsUint32 ());
279
+ Environment* env = Environment::GetCurrent (args);
280
+ int backlog;
281
+ if (!args[2 ]->Int32Value (env->context ()).To (&backlog)) return ;
287
282
// explicit cast to fit to libuv's type expectation
288
283
int port = static_cast <int >(args[2 ].As <Uint32>()->Value ());
289
284
Connect<sockaddr_in>(args, [port](const char * ip_address, sockaddr_in* addr) {
@@ -293,7 +288,7 @@ void TCPWrap::Connect(const FunctionCallbackInfo<Value>& args) {
293
288
294
289
void TCPWrap::Connect6 (const FunctionCallbackInfo<Value>& args) {
295
290
Environment* env = Environment::GetCurrent (args);
296
- CHECK (args[ 2 ]-> IsUint32 ());
291
+
297
292
int port;
298
293
if (!args[2 ]->Int32Value (env->context ()).To (&port)) return ;
299
294
Connect<sockaddr_in6>(args,
You can’t perform that action at this time.
0 commit comments