Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
net: do not reach through readableState for ended, do not maniplate .…
…readable
  • Loading branch information
chrisdickinson committed Feb 4, 2015
commit cc402e5d5415198750da98de81c74cdbfa8020e3
6 changes: 1 addition & 5 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,10 @@ function onSocketFinish() {
}

debug('onSocketFinish');
if (!this.readable || this._readableState.ended) {
if (!this.readable) {
debug('oSF: ended, destroy', this._readableState);
return this.destroy();
}

debug('oSF: not ended, call shutdown()');

// otherwise, just shutdown, or destroy() if not possible
Expand Down Expand Up @@ -238,13 +237,10 @@ function onSocketEnd() {
// ended should already be true, since this is called *after*
// the EOF errno and onread has eof'ed
debug('onSocketEnd', this._readableState);
this._readableState.ended = true;
if (this._readableState.endEmitted) {
this.readable = false;
maybeDestroy(this);
} else {
this.once('end', function() {
this.readable = false;
maybeDestroy(this);
});
this.read(0);
Expand Down