Skip to content

Commit

Permalink
src: use HandleScope in StreamReq::Done()
Browse files Browse the repository at this point in the history
Fixes: #38707

PR-URL: #38720
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
RaisinTen authored and jasnell committed May 21, 2021
1 parent 13ec317 commit fcdb1db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/stream_base-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ void StreamReq::Done(int status, const char* error_str) {
AsyncWrap* async_wrap = GetAsyncWrap();
Environment* env = async_wrap->env();
if (error_str != nullptr) {
v8::HandleScope handle_scope(env->isolate());
async_wrap->object()->Set(env->context(),
env->error_string(),
OneByteString(env->isolate(), error_str))
Expand Down
13 changes: 13 additions & 0 deletions test/parallel/test-https-agent-unref-socket.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');

const https = require('https');

const request = https.get('https://example.com');

request.on('socket', (socket) => {
socket.unref();
});

0 comments on commit fcdb1db

Please sign in to comment.