@@ -541,19 +541,9 @@ function onReadableStreamEnd() { |
|
|
541 |
541 |
if (this.writable) |
542 |
542 |
this.end(); |
543 |
543 |
} |
544 |
|
-maybeDestroy(this); |
545 |
|
-} |
546 |
|
- |
547 |
544 |
|
548 |
|
-// Call whenever we set writable=false or readable=false |
549 |
|
-function maybeDestroy(socket) { |
550 |
|
-if (!socket.readable && |
551 |
|
-!socket.writable && |
552 |
|
-!socket.destroyed && |
553 |
|
-!socket.connecting && |
554 |
|
-!socket.writableLength) { |
555 |
|
-socket.destroy(); |
556 |
|
-} |
|
545 |
+if (!this.destroyed && !this.writable && !this.writableLength) |
|
546 |
+this.destroy(); |
557 |
547 |
} |
558 |
548 |
|
559 |
549 |
|