Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6fb88f7

Browse files
committed
Wrap adoptSocket
1 parentc067109 commit6fb88f7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

‎src/AppWrapper.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,19 @@ std::pair<uWS::SocketContextOptions, bool> readOptionsObject(const FunctionCallb
713713
return {options,true};
714714
}
715715

716+
template<typename APP>
717+
voiduWS_App_adoptSocket(const FunctionCallbackInfo<Value> &args) {
718+
APP *app = (APP *) args.Holder()->GetAlignedPointerFromInternalField(0);
719+
720+
Isolate *isolate = args.GetIsolate();
721+
722+
int32_t fd = args[0]->Int32Value(isolate->GetCurrentContext()).ToChecked();
723+
724+
app->adoptSocket(fd);
725+
726+
args.GetReturnValue().Set(args.Holder());
727+
}
728+
716729
template<typename APP>
717730
voiduWS_App_addChildApp(const FunctionCallbackInfo<Value> &args) {
718731
APP *app = (APP *) args.Holder()->GetAlignedPointerFromInternalField(0);
@@ -971,7 +984,7 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
971984
/* load balancing*/
972985
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate,"addChildAppDescriptor", NewStringType::kNormal).ToLocalChecked(),FunctionTemplate::New(isolate, uWS_App_addChildApp<APP>, args.Data()));
973986
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate,"getDescriptor", NewStringType::kNormal).ToLocalChecked(),FunctionTemplate::New(isolate, uWS_App_getDescriptor<APP>, args.Data()));
974-
987+
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate,"adoptSocket", NewStringType::kNormal).ToLocalChecked(),FunctionTemplate::New(isolate, uWS_App_adoptSocket<APP>, args.Data()));
975988

976989
/* ws, listen*/
977990
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate,"ws", NewStringType::kNormal).ToLocalChecked(),FunctionTemplate::New(isolate, uWS_App_ws<APP>, args.Data()));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp