summaryrefslogtreecommitdiff
path: root/src/tls_wrap.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-11-12 14:01:08 +0000
committerAnna Henningsen <anna@addaleax.net>2019-11-19 13:47:33 +0100
commita489583eda4d7cebc06516834b31dc2a4cedb1b6 (patch)
tree8ead818f1ed28ce7c8965917209abc8d5b85bcb0 /src/tls_wrap.cc
parentc0b5e6fd4b87d1e61151b77b3ec10e6650f5153b (diff)
downloadandroid-node-v8-a489583eda4d7cebc06516834b31dc2a4cedb1b6.tar.gz
android-node-v8-a489583eda4d7cebc06516834b31dc2a4cedb1b6.tar.bz2
android-node-v8-a489583eda4d7cebc06516834b31dc2a4cedb1b6.zip
src: remove keep alive option from SetImmediate()
This is no longer necessary now that the copyable `BaseObjectPtr` is available (as opposed to the only-movable `v8::Global`). PR-URL: https://github.com/nodejs/node/pull/30374 Refs: https://github.com/nodejs/quic/pull/141 Refs: https://github.com/nodejs/quic/pull/149 Refs: https://github.com/nodejs/quic/pull/141 Refs: https://github.com/nodejs/quic/pull/165 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'src/tls_wrap.cc')
-rw-r--r--src/tls_wrap.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc
index 42b9469e38..4ec6dda6df 100644
--- a/src/tls_wrap.cc
+++ b/src/tls_wrap.cc
@@ -316,9 +316,10 @@ void TLSWrap::EncOut() {
// its not clear if it is always correct. Not calling Done() could block
// data flow, so for now continue to call Done(), just do it in the next
// tick.
- env()->SetImmediate([this](Environment* env) {
+ BaseObjectPtr<TLSWrap> strong_ref{this};
+ env()->SetImmediate([this, strong_ref](Environment* env) {
InvokeQueued(0);
- }, object());
+ });
}
}
return;
@@ -349,9 +350,10 @@ void TLSWrap::EncOut() {
HandleScope handle_scope(env()->isolate());
// Simulate asynchronous finishing, TLS cannot handle this at the moment.
- env()->SetImmediate([this](Environment* env) {
+ BaseObjectPtr<TLSWrap> strong_ref{this};
+ env()->SetImmediate([this, strong_ref](Environment* env) {
OnStreamAfterWrite(nullptr, 0);
- }, object());
+ });
}
}
@@ -718,9 +720,10 @@ int TLSWrap::DoWrite(WriteWrap* w,
StreamWriteResult res =
underlying_stream()->Write(bufs, count, send_handle);
if (!res.async) {
- env()->SetImmediate([this](Environment* env) {
+ BaseObjectPtr<TLSWrap> strong_ref{this};
+ env()->SetImmediate([this, strong_ref](Environment* env) {
OnStreamAfterWrite(current_empty_write_, 0);
- }, object());
+ });
}
return 0;
}