Browse Source

tls: rename `clientError` to `tlsClientError`

`clientError` will have `http.Server`-specific behavior, and we don't
want to shadow it in `tls.Server`.

PR-URL: https://github.com/nodejs/node/pull/4557
Reviewed-By: Brian White <mscdex@mscdex.net>
process-exit-stdio-flushing
Fedor Indutny 9 years ago
parent
commit
1ab6b21360
  1. 2
      doc/api/tls.markdown
  2. 4
      lib/_tls_wrap.js
  3. 2
      test/parallel/test-tls-econnreset.js
  4. 2
      test/parallel/test-tls-no-sslv3.js
  5. 2
      test/parallel/test-tls-sni-option.js
  6. 2
      test/parallel/test-tls-timeout-server.js

2
doc/api/tls.markdown

@ -169,7 +169,7 @@ This class is a subclass of `net.Server` and has the same methods on it.
Instead of accepting just raw TCP connections, this accepts encrypted Instead of accepting just raw TCP connections, this accepts encrypted
connections using TLS or SSL. connections using TLS or SSL.
### Event: 'clientError' ### Event: 'tlsClientError'
`function (exception, tlsSocket) { }` `function (exception, tlsSocket) { }`

4
lib/_tls_wrap.js

@ -809,14 +809,14 @@ function Server(/* [options], listener */) {
errorEmitted = true; errorEmitted = true;
var connReset = new Error('socket hang up'); var connReset = new Error('socket hang up');
connReset.code = 'ECONNRESET'; connReset.code = 'ECONNRESET';
self.emit('clientError', connReset, socket); self.emit('tlsClientError', connReset, socket);
} }
}); });
socket.on('_tlsError', function(err) { socket.on('_tlsError', function(err) {
if (!socket._controlReleased && !errorEmitted) { if (!socket._controlReleased && !errorEmitted) {
errorEmitted = true; errorEmitted = true;
self.emit('clientError', err, socket); self.emit('tlsClientError', err, socket);
} }
}); });
}); });

2
test/parallel/test-tls-econnreset.js

@ -48,7 +48,7 @@ var connectError = null;
var server = tls.createServer({ ca: ca, cert: cert, key: key }, function(conn) { var server = tls.createServer({ ca: ca, cert: cert, key: key }, function(conn) {
throw 'unreachable'; throw 'unreachable';
}).on('clientError', function(err, conn) { }).on('tlsClientError', function(err, conn) {
assert(!clientError && conn); assert(!clientError && conn);
clientError = err; clientError = err;
}).listen(common.PORT, function() { }).listen(common.PORT, function() {

2
test/parallel/test-tls-no-sslv3.js

@ -48,7 +48,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
})); }));
}); });
server.on('clientError', err => errors.push(err)); server.on('tlsClientError', err => errors.push(err));
process.on('exit', function() { process.on('exit', function() {
if (/unknown option -ssl3/.test(stderr)) { if (/unknown option -ssl3/.test(stderr)) {

2
test/parallel/test-tls-sni-option.js

@ -110,7 +110,7 @@ var server = tls.createServer(serverOptions, function(c) {
serverResults.push({ sni: c.servername, authorized: c.authorized }); serverResults.push({ sni: c.servername, authorized: c.authorized });
}); });
server.on('clientError', function(err) { server.on('tlsClientError', function(err) {
serverResults.push(null); serverResults.push(null);
serverError = err.message; serverError = err.message;
}); });

2
test/parallel/test-tls-timeout-server.js

@ -25,7 +25,7 @@ var options = {
var server = tls.createServer(options, common.fail); var server = tls.createServer(options, common.fail);
server.on('clientError', function(err, conn) { server.on('tlsClientError', function(err, conn) {
conn.destroy(); conn.destroy();
server.close(); server.close();
clientErrors++; clientErrors++;

Loading…
Cancel
Save