| 2693 | }); |
| 2694 | |
| 2695 | function Duplex(options) { |
| 2696 | if (!(this instanceof Duplex)) |
| 2697 | return new Duplex(options); |
| 2698 | |
| 2699 | Readable.call(this, options); |
| 2700 | Writable.call(this, options); |
| 2701 | |
| 2702 | if (options && options.readable === false) |
| 2703 | this.readable = false; |
| 2704 | |
| 2705 | if (options && options.writable === false) |
| 2706 | this.writable = false; |
| 2707 | |
| 2708 | this.allowHalfOpen = true; |
| 2709 | if (options && options.allowHalfOpen === false) |
| 2710 | this.allowHalfOpen = false; |
| 2711 | |
| 2712 | this.once('end', onend); |
| 2713 | } |
| 2714 | |
| 2715 | // the no-half-open enforcer |
| 2716 | function onend() { |