Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 453bd18

Browse filesBrowse files
sam-githubBridgeAR
authored andcommitted
tls: do not confuse TLSSocket and Socket
Don't use "socket" to describe two different objects in the same function. PR-URL: #25153 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
1 parent e1d4f43 commit 453bd18
Copy full SHA for 453bd18

File tree

Expand file treeCollapse file tree

1 file changed

+13
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-11
lines changed
Open diff view settings
Collapse file

‎lib/_tls_wrap.js‎

Copy file name to clipboardExpand all lines: lib/_tls_wrap.js
+13-11Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ exports.connect = function connect(...args) {
12241224

12251225
const context = options.secureContext || tls.createSecureContext(options);
12261226

1227-
var socket = new TLSSocket(options.socket, {
1227+
var tlssock = new TLSSocket(options.socket, {
12281228
pipe: !!options.path,
12291229
secureContext: context,
12301230
isServer: false,
@@ -1235,12 +1235,14 @@ exports.connect = function connect(...args) {
12351235
requestOCSP: options.requestOCSP
12361236
});
12371237

1238-
socket[kConnectOptions] = options;
1238+
tlssock[kConnectOptions] = options;
12391239

12401240
if (cb)
1241-
socket.once('secureConnect', cb);
1241+
tlssock.once('secureConnect', cb);
12421242

12431243
if (!options.socket) {
1244+
// If user provided the socket, its their responsibility to manage its
1245+
// connectivity. If we created one internally, we connect it.
12441246
const connectOpt = {
12451247
path: options.path,
12461248
port: options.port,
@@ -1249,22 +1251,22 @@ exports.connect = function connect(...args) {
12491251
localAddress: options.localAddress,
12501252
lookup: options.lookup
12511253
};
1252-
socket.connect(connectOpt, socket._start);
1254+
tlssock.connect(connectOpt, tlssock._start);
12531255
}
12541256

1255-
socket._releaseControl();
1257+
tlssock._releaseControl();
12561258

12571259
if (options.session)
1258-
socket.setSession(options.session);
1260+
tlssock.setSession(options.session);
12591261

12601262
if (options.servername)
1261-
socket.setServername(options.servername);
1263+
tlssock.setServername(options.servername);
12621264

12631265
if (options.socket)
1264-
socket._start();
1266+
tlssock._start();
12651267

1266-
socket.on('secure', onConnectSecure);
1267-
socket.once('end', onConnectEnd);
1268+
tlssock.on('secure', onConnectSecure);
1269+
tlssock.once('end', onConnectEnd);
12681270

1269-
return socket;
1271+
return tlssock;
12701272
};

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.