GraftJS / jschan

JavaScript port of libchan based around streams
MIT License
157 stars 9 forks source link

Backpressure problem in stream session #38

Open heri16 opened 8 years ago

heri16 commented 8 years ago

According to the spec at https://nodejs.org/api/stream.html#stream_readable_read_size_1 Note: once the _read() method is called, it will not be called again until the push method is called.

This causes done() to never be called when ByteStream on remote-side has finished and is sending an { id: x } message. When done() is not called, back pressure is not released in session inStream.

stream/channels.js

ByteStream.prototype._read = function() {
74    var done = this._lastDone;
75    if (done) {
76      this._lastDone = null;
77      done();
78    }
79    return null;
80  };
heri16 commented 8 years ago

Could be a problem with nodejs itself on windows or a race condition between dispatch() and _read().