summaryrefslogtreecommitdiff
path: root/src/node_http2.cc
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-07-19 12:59:39 -0700
committerJames M Snell <jasnell@gmail.com>2017-08-04 12:56:39 -0700
commit953458f645697fee420a2bb5e24038f3a7bc44df (patch)
treed2ca198d46949c5a4b38e9c7597a2476ddca25ee /src/node_http2.cc
parent6911fe337ca0e7bb5695f519fb15669d010042dc (diff)
downloadandroid-node-v8-953458f645697fee420a2bb5e24038f3a7bc44df.tar.gz
android-node-v8-953458f645697fee420a2bb5e24038f3a7bc44df.tar.bz2
android-node-v8-953458f645697fee420a2bb5e24038f3a7bc44df.zip
http2: fix socketOnTimeout and a segfault
Fixes: https://github.com/nodejs/http2/issues/179 Was fixing issue #179 and encountered a segault that was happening somewhat randomly on session destruction. Both should be fixed PR-URL: https://github.com/nodejs/node/pull/14239 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/node_http2.cc')
-rwxr-xr-xsrc/node_http2.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/node_http2.cc b/src/node_http2.cc
index 5ad1352cc1..61a98758b1 100755
--- a/src/node_http2.cc
+++ b/src/node_http2.cc
@@ -401,13 +401,21 @@ void Http2Session::Consume(const FunctionCallbackInfo<Value>& args) {
}
void Http2Session::Destroy(const FunctionCallbackInfo<Value>& args) {
- DEBUG_HTTP2("Http2Session: destroying session\n");
Http2Session* session;
ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
+ DEBUG_HTTP2("Http2Session: destroying session %d\n", session->type());
session->Unconsume();
session->Free();
}
+void Http2Session::Destroying(const FunctionCallbackInfo<Value>& args) {
+ Http2Session* session;
+ ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
+ DEBUG_HTTP2("Http2Session: preparing to destroy session %d\n",
+ session->type());
+ session->MarkDestroying();
+}
+
void Http2Session::SubmitPriority(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
Http2Session* session;
@@ -816,11 +824,11 @@ void Http2Session::AllocateSend(size_t recommended, uv_buf_t* buf) {
}
void Http2Session::Send(uv_buf_t* buf, size_t length) {
+ DEBUG_HTTP2("Http2Session: Attempting to send data\n");
if (stream_ == nullptr || !stream_->IsAlive() || stream_->IsClosing()) {
return;
}
HandleScope scope(env()->isolate());
-
auto AfterWrite = [](WriteWrap* req_wrap, int status) {
req_wrap->Dispose();
};
@@ -1191,6 +1199,8 @@ void Initialize(Local<Object> target,
Http2Session::Consume);
env->SetProtoMethod(session, "destroy",
Http2Session::Destroy);
+ env->SetProtoMethod(session, "destroying",
+ Http2Session::Destroying);
env->SetProtoMethod(session, "sendHeaders",
Http2Session::SendHeaders);
env->SetProtoMethod(session, "submitShutdownNotice",