summaryrefslogtreecommitdiff
path: root/lib/tls.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tls.js')
-rw-r--r--lib/tls.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/tls.js b/lib/tls.js
index 97b7f7484..8b3654fa4 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -1298,6 +1298,18 @@ function pipe(pair, socket) {
cleartext.encrypted = pair.encrypted;
cleartext.authorized = false;
+ // cycle the data whenever the socket drains, so that
+ // we can pull some more into it. normally this would
+ // be handled by the fact that pipe() triggers read() calls
+ // on writable.drain, but CryptoStreams are a bit more
+ // complicated. Since the encrypted side actually gets
+ // its data from the cleartext side, we have to give it a
+ // light kick to get in motion again.
+ socket.on('drain', function() {
+ pair.encrypted.read(0);
+ pair.cleartext.read(0);
+ });
+
function onerror(e) {
if (cleartext._controlReleased) {
cleartext.emit('error', e);