summaryrefslogtreecommitdiff
path: root/lib/_tls_legacy.js
diff options
context:
space:
mode:
authorMinwoo Jung <jmwsoft@gmail.com>2015-08-21 14:30:08 -0700
committerminwoojung <minwoojung@minwoojungs-MacBook-Pro.local>2015-12-17 19:45:57 +0900
commitae5bcf9528e49c612c36b9c72d1d5602ecc18827 (patch)
tree6f25f8f5fa737c7942953d5ce4198609a80c627c /lib/_tls_legacy.js
parent93d6b5fb68eae8b0912579980e17ebf0723ab2cc (diff)
downloadandroid-node-v8-ae5bcf9528e49c612c36b9c72d1d5602ecc18827.tar.gz
android-node-v8-ae5bcf9528e49c612c36b9c72d1d5602ecc18827.tar.bz2
android-node-v8-ae5bcf9528e49c612c36b9c72d1d5602ecc18827.zip
lib: use arrow functions instead of bind
use `arrow functions` instead of `bind(this)` in order to improve performance through optimizations. PR-URL: https://github.com/nodejs/node/pull/3622 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'lib/_tls_legacy.js')
-rw-r--r--lib/_tls_legacy.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/_tls_legacy.js b/lib/_tls_legacy.js
index 52621c2a60..2c5bb62a19 100644
--- a/lib/_tls_legacy.js
+++ b/lib/_tls_legacy.js
@@ -704,14 +704,15 @@ function SecurePair(context, isServer, requestCert, rejectUnauthorized,
this._rejectUnauthorized);
if (this._isServer) {
- this.ssl.onhandshakestart = onhandshakestart.bind(this);
- this.ssl.onhandshakedone = onhandshakedone.bind(this);
- this.ssl.onclienthello = onclienthello.bind(this);
- this.ssl.onnewsession = onnewsession.bind(this);
+ this.ssl.onhandshakestart = () => onhandshakestart.call(this);
+ this.ssl.onhandshakedone = () => onhandshakedone.call(this);
+ this.ssl.onclienthello = (hello) => onclienthello.call(this, hello);
+ this.ssl.onnewsession =
+ (key, session) => onnewsession.call(this, key, session);
this.ssl.lastHandshakeTime = 0;
this.ssl.handshakes = 0;
} else {
- this.ssl.onocspresponse = onocspresponse.bind(this);
+ this.ssl.onocspresponse = (resp) => onocspresponse.call(this, resp);
}
if (process.features.tls_sni) {