From 97977640bd3e45ef3c907a37a573716dba6e2a93 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Mon, 25 Oct 2010 15:41:58 -0700 Subject: [PATCH] Set the readable variables on the read/write streams and add more debug() calls to make it easier to see the flow --- lib/securepair.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/securepair.js b/lib/securepair.js index 6cdf2f18ec..c9d1ac0893 100644 --- a/lib/securepair.js +++ b/lib/securepair.js @@ -66,9 +66,10 @@ function SecurePair(credentials, is_server) /* Acts as a r/w stream to the cleartext side of the stream. */ this.cleartext = new stream.Stream(); - + this.cleartext.readable = true; /* Acts as a r/w stream to the encrypted side of the stream. */ this.encrypted = new stream.Stream(); + this.encrypted.readable = true; this.cleartext.write = function(data) { debug('clearIn data'); @@ -78,10 +79,12 @@ function SecurePair(credentials, is_server) }; this.cleartext.pause = function() { + debug('paused cleartext'); self._cleartext_write_state = false; }; this.cleartext.resume = function() { + debug('resumed cleartext'); self._cleartext_write_state = true; }; @@ -102,10 +105,12 @@ function SecurePair(credentials, is_server) }; this.encrypted.pause = function() { + debug('pause encrypted'); self._encrypted_write_state = false; }; this.encrypted.resume = function() { + debug('resume encrypted'); self._encrypted_write_state = true; }; @@ -215,6 +220,7 @@ SecurePair.prototype._cycle = function() { tmp = this._encIn_pending.shift(); try { + debug('writng from encIn'); rv = this._ssl.encIn(tmp, 0, tmp.length); } catch (e) { return this._error(e); @@ -231,6 +237,7 @@ SecurePair.prototype._cycle = function() { while (this._clearIn_pending.length > 0) { tmp = this._clearIn_pending.shift(); try { + debug('writng from clearIn'); rv = this._ssl.clearIn(tmp, 0, tmp.length); } catch (e) { return this._error(e); @@ -276,6 +283,7 @@ SecurePair.prototype._cycle = function() { mover( function(pool, offset, length) { + debug('reading from clearOut'); return self._ssl.clearOut(pool, offset, length); }, function(chunk) { @@ -287,6 +295,7 @@ SecurePair.prototype._cycle = function() { mover( function(pool, offset, length) { + debug('reading from encOut'); return self._ssl.encOut(pool, offset, length); }, function(chunk) {