@@ -726,6 +726,22 @@ void uWS_App_adoptSocket(const FunctionCallbackInfo<Value> &args) {
726
726
args.GetReturnValue ().Set (args.Holder ());
727
727
}
728
728
729
+ template <typename APP>
730
+ void uWS_App_removeChildApp (const FunctionCallbackInfo<Value> &args) {
731
+ APP *app = (APP *) args.Holder ()->GetAlignedPointerFromInternalField (0 );
732
+
733
+ Isolate *isolate = args.GetIsolate ();
734
+
735
+ double descriptor = args[0 ]->NumberValue (isolate->GetCurrentContext ()).ToChecked ();
736
+
737
+ APP *receivingApp;
738
+ memcpy (&receivingApp, &descriptor, sizeof (receivingApp));
739
+
740
+ app->removeChildApp (receivingApp);
741
+
742
+ args.GetReturnValue ().Set (args.Holder ());
743
+ }
744
+
729
745
template <typename APP>
730
746
void uWS_App_addChildApp (const FunctionCallbackInfo<Value> &args) {
731
747
APP *app = (APP *) args.Holder ()->GetAlignedPointerFromInternalField (0 );
@@ -982,6 +998,7 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
982
998
appTemplate->PrototypeTemplate ()->Set (String::NewFromUtf8 (isolate, " filter" , NewStringType::kNormal ).ToLocalChecked (), FunctionTemplate::New (isolate, uWS_App_filter<APP>, args.Data ()));
983
999
984
1000
/* load balancing */
1001
+ appTemplate->PrototypeTemplate ()->Set (String::NewFromUtf8 (isolate, " removeChildAppDescriptor" , NewStringType::kNormal ).ToLocalChecked (), FunctionTemplate::New (isolate, uWS_App_removeChildApp<APP>, args.Data ()));
985
1002
appTemplate->PrototypeTemplate ()->Set (String::NewFromUtf8 (isolate, " addChildAppDescriptor" , NewStringType::kNormal ).ToLocalChecked (), FunctionTemplate::New (isolate, uWS_App_addChildApp<APP>, args.Data ()));
986
1003
appTemplate->PrototypeTemplate ()->Set (String::NewFromUtf8 (isolate, " getDescriptor" , NewStringType::kNormal ).ToLocalChecked (), FunctionTemplate::New (isolate, uWS_App_getDescriptor<APP>, args.Data ()));
987
1004
appTemplate->PrototypeTemplate ()->Set (String::NewFromUtf8 (isolate, " adoptSocket" , NewStringType::kNormal ).ToLocalChecked (), FunctionTemplate::New (isolate, uWS_App_adoptSocket<APP>, args.Data ()));
0 commit comments