GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tls: do not confuse TLSSocket and Socket · nodejs/node@453bd18

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • _tls_wrap.js
Expand file treeCollapse file tree
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)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.