summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Querna <pquerna@apache.org>2010-10-25 15:41:58 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-10-25 17:28:21 -0700
commit97977640bd3e45ef3c907a37a573716dba6e2a93 (patch)
tree60b70254e1adc174ccfa2e9b0bb4401ca23e0684
parent1128c0bf67221b3b3d6ba729ee212648521c226d (diff)
downloadnode-new-97977640bd3e45ef3c907a37a573716dba6e2a93.tar.gz
Set the readable variables on the read/write streams
and add more debug() calls to make it easier to see the flow
-rw-r--r--lib/securepair.js11
1 files changed, 10 insertions, 1 deletions
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) {