diff options
author | Fedor Indutny <fedor@indutny.com> | 2014-11-04 11:14:55 -0500 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-11-20 18:14:57 +0300 |
commit | 963f5e8a886841d69e79fdc46aaa0010126408e8 (patch) | |
tree | aad68636a04adc8e488d25664eaa43f846205d3b /lib | |
parent | f8076c40672d6317d8c2e1259b5d23235156cd99 (diff) | |
download | android-node-v8-963f5e8a886841d69e79fdc46aaa0010126408e8.tar.gz android-node-v8-963f5e8a886841d69e79fdc46aaa0010126408e8.tar.bz2 android-node-v8-963f5e8a886841d69e79fdc46aaa0010126408e8.zip |
tls: do not hang without `newSession` handler
When listening for client hello parser events (like OCSP requests), do
not hang if `newSession` event handler is not present.
fix joyent/node#8660
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/node-forward/node/pull/47
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_tls_legacy.js | 7 | ||||
-rw-r--r-- | lib/_tls_wrap.js | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/_tls_legacy.js b/lib/_tls_legacy.js index 5e501be9a6..3f6d20784b 100644 --- a/lib/_tls_legacy.js +++ b/lib/_tls_legacy.js @@ -655,14 +655,17 @@ function onnewsession(key, session) { var self = this; var once = false; - self.server.emit('newSession', key, session, function() { + if (!self.server.emit('newSession', key, session, done)) + done(); + + function done() { if (once) return; once = true; if (self.ssl) self.ssl.newSessionDone(); - }); + }; } diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 4ec92801b1..703f125839 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -200,7 +200,10 @@ function onnewsession(key, session) { var once = false; this._newSessionPending = true; - this.server.emit('newSession', key, session, function() { + if (!this.server.emit('newSession', key, session, done)) + done(); + + function done() { if (once) return; once = true; @@ -211,7 +214,7 @@ function onnewsession(key, session) { if (self._securePending) self._finishInit(); self._securePending = false; - }); + } } |