File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -482,6 +482,17 @@ class Parser : public WeakObject {
482482 }
483483
484484
485+ template <bool should_pause>
486+ static void Pause (const FunctionCallbackInfo<Value>& args) {
487+ Environment* env = Environment::GetCurrent (args.GetIsolate ());
488+ HandleScope handle_scope (args.GetIsolate ());
489+ Parser* parser = WeakObject::Unwrap<Parser>(args.This ());
490+ // Should always be called from the same context.
491+ assert (env == parser->env ());
492+ http_parser_pause (&parser->parser_ , should_pause);
493+ }
494+
495+
485496 private:
486497
487498 Local<Array> CreateHeaders () {
@@ -588,6 +599,8 @@ void InitHttpParser(Handle<Object> target,
588599 NODE_SET_PROTOTYPE_METHOD (t, " execute" , Parser::Execute);
589600 NODE_SET_PROTOTYPE_METHOD (t, " finish" , Parser::Finish);
590601 NODE_SET_PROTOTYPE_METHOD (t, " reinitialize" , Parser::Reinitialize);
602+ NODE_SET_PROTOTYPE_METHOD (t, " pause" , Parser::Pause<true >);
603+ NODE_SET_PROTOTYPE_METHOD (t, " resume" , Parser::Pause<false >);
591604
592605 target->Set (FIXED_ONE_BYTE_STRING (node_isolate, " HTTPParser" ),
593606 t->GetFunction ());
You can’t perform that action at this time.
0 commit comments